Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-06-25 11:59:00 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2018-06-28 14:50:17 +0300
commit54b56f20b7a70d3e6284c8105eb3d4a568e255b0 (patch)
treede18fca7bd27dcd55817e21c4654cf36c1430c5f /app/presenters
parent627236c9edd7f085ec5070ef7fcfbcbfc9b6de78 (diff)
Expose permissions on types in GraphQL
This adds a reusable way to expose permissions for a user to types in GraphQL.
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/merge_request_presenter.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/presenters/merge_request_presenter.rb b/app/presenters/merge_request_presenter.rb
index eb54ab2cda6..f77b3541644 100644
--- a/app/presenters/merge_request_presenter.rb
+++ b/app/presenters/merge_request_presenter.rb
@@ -168,6 +168,10 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
.can_push_to_branch?(source_branch)
end
+ def can_remove_source_branch?
+ source_branch_exists? && merge_request.can_remove_source_branch?(current_user)
+ end
+
def mergeable_discussions_state
# This avoids calling MergeRequest#mergeable_discussions_state without
# considering the state of the MR first. If a MR isn't mergeable, we can