summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-04-06 14:18:58 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-04-11 10:51:15 +0200
commit8ad9c4e873f2185e8bbfa6f363db32dbbba27141 (patch)
treecefefd09ed7f5b03307f31d240f7a20d757ac185 /app/helpers
parentec43e3644436e0ae90f6fb6a64256c38ceb68cc9 (diff)
downloadgitlab-ce-8ad9c4e873f2185e8bbfa6f363db32dbbba27141.tar.gz
Rename `create_merge_request` permissions
So we can distinguish between the permissions on the source and the target project. - `create_merge_request_from` indicates a user can create a merge request with the project as a source_project - `create_merge_request_in` indicates a user can create a merge request with the project as a target_project
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/blob_helper.rb6
-rw-r--r--app/helpers/compare_helper.rb2
2 files changed, 4 insertions, 4 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb
index ac7b8d6672e..a5f7a7204df 100644
--- a/app/helpers/blob_helper.rb
+++ b/app/helpers/blob_helper.rb
@@ -59,7 +59,7 @@ module BlobHelper
button_tag label, class: "#{common_classes} disabled has-tooltip", title: "It is not possible to #{action} files that are stored in LFS using the web interface", data: { container: 'body' }
elsif can_modify_blob?(blob, project, ref)
button_tag label, class: "#{common_classes}", 'data-target' => "#modal-#{modal_type}-blob", 'data-toggle' => 'modal'
- elsif can?(current_user, :create_merge_request_in_project, project)
+ elsif can?(current_user, :create_merge_request_in, project)
edit_fork_button_tag(common_classes, project, label, edit_modify_file_fork_params(action), action)
end
end
@@ -280,7 +280,7 @@ module BlobHelper
options << link_to("submit an issue", new_project_issue_path(project))
end
- merge_project = can?(current_user, :create_merge_request, project) ? project : (current_user && current_user.fork_of(project))
+ merge_project = can?(current_user, :create_merge_request_from, project) ? project : (current_user && current_user.fork_of(project))
if merge_project
options << link_to("create a merge request", project_new_merge_request_path(project))
end
@@ -334,7 +334,7 @@ module BlobHelper
# Web IDE (Beta) requires the user to have this feature enabled
elsif !current_user || (current_user && can_modify_blob?(blob, project, ref))
edit_link_tag(text, edit_path, common_classes)
- elsif can?(current_user, :create_merge_request_in_project, project)
+ elsif can?(current_user, :fork_project, project) && can?(current_user, :create_merge_request_in, project)
edit_fork_button_tag(common_classes, project, text, edit_blob_fork_params(edit_path))
end
end
diff --git a/app/helpers/compare_helper.rb b/app/helpers/compare_helper.rb
index 8bf96c0905f..2df5b5d1695 100644
--- a/app/helpers/compare_helper.rb
+++ b/app/helpers/compare_helper.rb
@@ -3,7 +3,7 @@ module CompareHelper
from.present? &&
to.present? &&
from != to &&
- can?(current_user, :create_merge_request, project) &&
+ can?(current_user, :create_merge_request_from, project) &&
project.repository.branch_exists?(from) &&
project.repository.branch_exists?(to)
end