diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /app/helpers/commits_helper.rb | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) | |
download | gitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'app/helpers/commits_helper.rb')
-rw-r--r-- | app/helpers/commits_helper.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 42e4844cc8d..e7a81eb5629 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -110,16 +110,18 @@ module CommitsHelper end end - def revert_commit_link - return unless current_user - - tag(:div, data: { display_text: 'Revert' }, class: "js-revert-commit-trigger") - end - - def cherry_pick_commit_link - return unless current_user - - tag(:div, data: { display_text: 'Cherry-pick' }, class: "js-cherry-pick-commit-trigger") + def commit_options_dropdown_data(project, commit) + can_collaborate = current_user && can_collaborate_with_project?(project) + + { + new_project_tag_path: new_project_tag_path(project, ref: commit), + email_patches_path: project_commit_path(project, commit, format: :patch), + plain_diff_path: project_commit_path(project, commit, format: :diff), + can_revert: "#{can_collaborate && !commit.has_been_reverted?(current_user)}", + can_cherry_pick: can_collaborate.to_s, + can_tag: can?(current_user, :push_code, project).to_s, + can_email_patches: (commit.parents.length < 2).to_s + } end def commit_signature_badge_classes(additional_classes) @@ -137,7 +139,7 @@ module CommitsHelper def cherry_pick_projects_data(project) return [] unless Feature.enabled?(:pick_into_project, project, default_enabled: :yaml) - target_projects(project).map do |project| + [project, project.forked_from_project].compact.map do |project| { id: project.id.to_s, name: project.full_path, |