summaryrefslogtreecommitdiff
path: root/app/controllers/projects
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-14 12:08:53 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-14 12:08:53 +0000
commit8a5138ed7d38ccff8b5ca2fe0f7bbb77f8fdaad3 (patch)
tree4c0d373c990fc01cacff9b4093366ab398fcb7d3 /app/controllers/projects
parent6d8f30ab0ae82678f10450d2158f24772f0c765c (diff)
downloadgitlab-ce-8a5138ed7d38ccff8b5ca2fe0f7bbb77f8fdaad3.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/blame_controller.rb26
1 files changed, 10 insertions, 16 deletions
diff --git a/app/controllers/projects/blame_controller.rb b/app/controllers/projects/blame_controller.rb
index bd5701a3557..cc0d3818e33 100644
--- a/app/controllers/projects/blame_controller.rb
+++ b/app/controllers/projects/blame_controller.rb
@@ -20,28 +20,14 @@ class Projects::BlameController < Projects::ApplicationController
end
load_environment
-
- @blame_mode = Gitlab::Git::BlameMode.new(@commit.project, blame_params)
- blame_service = Projects::BlameService.new(@blob, @commit, @blame_mode, blame_params)
-
- @blame = Gitlab::View::Presenter::Factory.new(blame_service.blame, project: @project, path: @path, page: blame_service.page).fabricate!
-
- @blame_pagination = blame_service.pagination
-
- @blame_per_page = blame_service.per_page
-
- render locals: { total_extra_pages: blame_service.total_extra_pages }
+ load_blame
end
def page
@blob = @repository.blob_at(@commit.id, @path)
load_environment
-
- @blame_mode = Gitlab::Git::BlameMode.new(@commit.project, blame_params)
- blame_service = Projects::BlameService.new(@blob, @commit, @blame_mode, blame_params)
-
- @blame = Gitlab::View::Presenter::Factory.new(blame_service.blame, project: @project, path: @path, page: blame_service.page).fabricate!
+ load_blame
render partial: 'page'
end
@@ -54,6 +40,14 @@ class Projects::BlameController < Projects::ApplicationController
@environment = ::Environments::EnvironmentsByDeploymentsFinder.new(@project, current_user, environment_params).execute.last
end
+ def load_blame
+ @blame_mode = Gitlab::Git::BlameMode.new(@commit.project, blame_params)
+ @blame_pagination = Gitlab::Git::BlamePagination.new(@blob, @blame_mode, blame_params)
+
+ blame = Gitlab::Blame.new(@blob, @commit, range: @blame_pagination.blame_range)
+ @blame = Gitlab::View::Presenter::Factory.new(blame, project: @project, path: @path, page: @blame_pagination.page).fabricate!
+ end
+
def blame_params
params.permit(:page, :no_pagination, :streaming)
end