diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 89c36edbe14..fb7c6afe77e 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -123,10 +123,10 @@ module CommitsHelper ) end - def revert_commit_link(show_modal_condition, continue_to_path, btn_class: nil) + def revert_commit_link(continue_to_path, btn_class: nil) return unless current_user - if show_modal_condition + if can_collaborate_with_project? content_tag :span, 'data-toggle' => 'modal', 'data-target' => '#modal-revert-commit' do link_to 'Revert', '#modal-revert-commit', 'data-toggle' => 'tooltip', 'data-original-title' => 'Create merge request to revert commit', class: "btn btn-close btn-#{btn_class}" end diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index f5d90b7791d..1dd07a2a220 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -92,10 +92,4 @@ module MergeRequestsHelper ["#{source_path}:#{source_branch}", "#{target_path}:#{target_branch}"] end end - - def can_update_merge_request? - project ||= @project - - can_collaborate_with_project?(project) - end end diff --git a/app/views/projects/commit/_commit_box.html.haml b/app/views/projects/commit/_commit_box.html.haml index 95d6465adfc..14f4e429f13 100644 --- a/app/views/projects/commit/_commit_box.html.haml +++ b/app/views/projects/commit/_commit_box.html.haml @@ -16,7 +16,7 @@ = link_to namespace_project_tree_path(@project.namespace, @project, @commit), class: "btn btn-grouped" do = icon('files-o') Browse Files - = revert_commit_link(can_collaborate_with_project?, namespace_project_commit_path(@project.namespace, @project, @commit.id)) + = revert_commit_link(namespace_project_commit_path(@project.namespace, @project, @commit.id)) %div %p diff --git a/app/views/projects/merge_requests/widget/_merged.html.haml b/app/views/projects/merge_requests/widget/_merged.html.haml index 2add37387ad..9bbdbb90eb0 100644 --- a/app/views/projects/merge_requests/widget/_merged.html.haml +++ b/app/views/projects/merge_requests/widget/_merged.html.haml @@ -7,7 +7,7 @@ by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)} #{time_ago_with_tooltip(@merge_request.merge_event.created_at)} - if @merge_request.merge_commit_sha.present? - = revert_commit_link(can_update_merge_request?, namespace_project_merge_request_path(@project.namespace, @project, @merge_request), btn_class: 'sm') + = revert_commit_link(namespace_project_merge_request_path(@project.namespace, @project, @merge_request), btn_class: 'sm') %div - if !@merge_request.source_branch_exists? || (params[:delete_source] == 'true') The changes were merged into