diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/helpers/commits_helper.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) | |
download | gitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/helpers/commits_helper.rb')
-rw-r--r-- | app/helpers/commits_helper.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index e7a81eb5629..9b952ad127e 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -128,7 +128,7 @@ module CommitsHelper %w(btn gpg-status-box) + Array(additional_classes) end - def conditionally_paginate_diff_files(diffs, paginate:, per: Projects::CommitController::COMMIT_DIFFS_PER_PAGE) + def conditionally_paginate_diff_files(diffs, paginate:, per:) if paginate Kaminari.paginate_array(diffs.diff_files.to_a).page(params[:page]).per(per) else @@ -148,6 +148,27 @@ module CommitsHelper end end + # This is used to calculate a cache key for the app/views/projects/commits/_commit.html.haml + # partial. It takes some of the same parameters as used in the partial and will hash the + # current pipeline status. + # + # This includes a keyed hash for values that can be nil, to prevent invalid cache entries + # being served if the order should change in future. + def commit_partial_cache_key(commit, ref:, merge_request:, request:) + [ + commit, + commit.author, + ref, + { + merge_request: merge_request, + pipeline_status: commit.status_for(ref), + xhr: request.xhr?, + controller: controller.controller_path, + path: @path # referred to in #link_to_browse_code + } + ] + end + protected # Private: Returns a link to a person. If the person has a matching user and |