diff options
Diffstat (limited to 'app/views/projects/commit/_change.html.haml')
-rw-r--r-- | app/views/projects/commit/_change.html.haml | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/app/views/projects/commit/_change.html.haml b/app/views/projects/commit/_change.html.haml index 81a77489075..e04c4ebfda2 100644 --- a/app/views/projects/commit/_change.html.haml +++ b/app/views/projects/commit/_change.html.haml @@ -1,3 +1,12 @@ +- can_push_code = can?(current_user, :push_code, @project) + +- if !can_push_code && selected_branch.present? + - branch_collaboration = @project.branch_allows_collaboration?(current_user, selected_branch) + - existing_branch = ERB::Util.html_escape(selected_branch) +- else + - branch_collaboration = false + - existing_branch = '' + - case type.to_s - when 'revert' - revert_merge_request = _('Revert this merge request') @@ -7,9 +16,9 @@ .js-revert-commit-modal{ data: { title: title, endpoint: revert_namespace_project_commit_path(commit, namespace_id: @project.namespace.full_path, project_id: @project), branch: @project.default_branch, - push_code: can?(current_user, :push_code, @project).to_s, - branch_collaboration: @project.branch_allows_collaboration?(current_user, selected_branch).to_s, - existing_branch: ERB::Util.html_escape(selected_branch), + push_code: can_push_code.to_s, + branch_collaboration: branch_collaboration.to_s, + existing_branch: existing_branch, branches_endpoint: project_branches_path(@project) } } - when 'cherry-pick' @@ -20,8 +29,8 @@ branch: @project.default_branch, target_project_id: @project.id, target_project_name: @project.full_path, - push_code: can?(current_user, :push_code, @project).to_s, - branch_collaboration: @project.branch_allows_collaboration?(current_user, selected_branch).to_s, - existing_branch: ERB::Util.html_escape(selected_branch), + push_code: can_push_code.to_s, + branch_collaboration: branch_collaboration.to_s, + existing_branch: existing_branch, branches_endpoint: refs_project_path(@project), projects: cherry_pick_projects_data(@project).to_json } } |