Commit e8d15f13 authored by Rubén Dávila's avatar Rubén Dávila Committed by Robert Speicher

Refactor revert_commit_link helper.

parent a07021fa
...@@ -123,10 +123,10 @@ module CommitsHelper ...@@ -123,10 +123,10 @@ module CommitsHelper
) )
end 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 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 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}" 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 end
......
...@@ -92,10 +92,4 @@ module MergeRequestsHelper ...@@ -92,10 +92,4 @@ module MergeRequestsHelper
["#{source_path}:#{source_branch}", "#{target_path}:#{target_branch}"] ["#{source_path}:#{source_branch}", "#{target_path}:#{target_branch}"]
end end
end end
def can_update_merge_request?
project ||= @project
can_collaborate_with_project?(project)
end
end end
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
= link_to namespace_project_tree_path(@project.namespace, @project, @commit), class: "btn btn-grouped" do = link_to namespace_project_tree_path(@project.namespace, @project, @commit), class: "btn btn-grouped" do
= icon('files-o') = icon('files-o')
Browse Files 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 %div
%p %p
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)} by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)}
#{time_ago_with_tooltip(@merge_request.merge_event.created_at)} #{time_ago_with_tooltip(@merge_request.merge_event.created_at)}
- if @merge_request.merge_commit_sha.present? - 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 %div
- if !@merge_request.source_branch_exists? || (params[:delete_source] == 'true') - if !@merge_request.source_branch_exists? || (params[:delete_source] == 'true')
The changes were merged into The changes were merged into
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment