diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/blame_controller.rb | 5 | ||||
-rw-r--r-- | app/controllers/projects/merge_requests/diffs_controller.rb | 15 | ||||
-rw-r--r-- | app/controllers/projects/merge_requests/drafts_controller.rb | 8 |
3 files changed, 8 insertions, 20 deletions
diff --git a/app/controllers/projects/blame_controller.rb b/app/controllers/projects/blame_controller.rb index 5bfda526fb0..2a20c67a23d 100644 --- a/app/controllers/projects/blame_controller.rb +++ b/app/controllers/projects/blame_controller.rb @@ -23,11 +23,10 @@ class Projects::BlameController < Projects::ApplicationController environment_params[:find_latest] = true @environment = ::Environments::EnvironmentsByDeploymentsFinder.new(@project, current_user, environment_params).execute.last - blame_service = Projects::BlameService.new(@blob, @commit, params.permit(:page)) + blame_service = Projects::BlameService.new(@blob, @commit, params.permit(:page, :no_pagination)) @blame = Gitlab::View::Presenter::Factory.new(blame_service.blame, project: @project, path: @path, page: blame_service.page).fabricate! - - render locals: { blame_pagination: blame_service.pagination } + @blame_pagination = blame_service.pagination end end diff --git a/app/controllers/projects/merge_requests/diffs_controller.rb b/app/controllers/projects/merge_requests/diffs_controller.rb index f04412d7603..a68c2ffa06d 100644 --- a/app/controllers/projects/merge_requests/diffs_controller.rb +++ b/app/controllers/projects/merge_requests/diffs_controller.rb @@ -64,20 +64,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic return unless stale?(etag: [cache_context + diff_options_hash.fetch(:paths, []), diffs]) - if diff_options_hash[:paths].blank? - if Feature.enabled?(:remove_caching_diff_batches, @merge_request.project) - render json: PaginatedDiffSerializer.new(current_user: current_user).represent(diffs, options) - else - render_cached( - diffs, - with: PaginatedDiffSerializer.new(current_user: current_user), - cache_context: -> (_) { [Digest::SHA256.hexdigest(cache_context.to_s)] }, - **options - ) - end - else - render json: PaginatedDiffSerializer.new(current_user: current_user).represent(diffs, options) - end + render json: PaginatedDiffSerializer.new(current_user: current_user).represent(diffs, options) end # rubocop: enable Metrics/AbcSize diff --git a/app/controllers/projects/merge_requests/drafts_controller.rb b/app/controllers/projects/merge_requests/drafts_controller.rb index c75c3099051..74bb3ad1a63 100644 --- a/app/controllers/projects/merge_requests/drafts_controller.rb +++ b/app/controllers/projects/merge_requests/drafts_controller.rb @@ -57,10 +57,12 @@ class Projects::MergeRequests::DraftsController < Projects::MergeRequests::Appli end if Gitlab::Utils.to_boolean(approve_params[:approve]) - success = ::MergeRequests::ApprovalService.new(project: @project, current_user: current_user, params: approve_params).execute(merge_request) + unless merge_request.approved_by?(current_user) + success = ::MergeRequests::ApprovalService.new(project: @project, current_user: current_user, params: approve_params).execute(merge_request) - unless success - return render json: { message: _('An error occurred while approving, please try again.') }, status: :internal_server_error + unless success + return render json: { message: _('An error occurred while approving, please try again.') }, status: :internal_server_error + end end merge_request_activity_counter.track_submit_review_approve(user: current_user) |