debian-mirror-gitlab/app/controllers/projects/blame_controller.rb

20 lines
615 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
# Controller for viewing a file's blame
class Projects::BlameController < Projects::ApplicationController
include ExtractsPath
2015-09-11 14:41:01 +05:30
before_action :require_non_empty_project
before_action :assign_ref_vars
before_action :authorize_download_code!
2014-09-02 18:07:02 +05:30
def show
2015-09-11 14:41:01 +05:30
@blob = @repository.blob_at(@commit.id, @path)
2017-08-17 22:00:37 +05:30
return render_404 unless @blob
environment_params = @repository.branch_exists?(@ref) ? { ref: @ref } : { commit: @commit }
@environment = EnvironmentsFinder.new(@project, current_user, environment_params).execute.last
2016-02-05 20:25:01 +05:30
@blame_groups = Gitlab::Blame.new(@blob, @commit).groups
2014-09-02 18:07:02 +05:30
end
end