summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-08-04 22:02:55 +0000
committerRobert Speicher <robert@gitlab.com>2016-08-04 22:02:55 +0000
commitaf7e669e88b7bfd11d105d62c34a3d7ce0afeff1 (patch)
treeb294858a72b7607cda1bf7c5a9c562cbd9be886c
parent1aba0668ee0c98b5274517692c73958801cdb285 (diff)
parent705085db0c3b869f62f1b0f742686cc2082001fa (diff)
downloadgitlab-ce-af7e669e88b7bfd11d105d62c34a3d7ce0afeff1.tar.gz
Merge branch '20621-avoid-lame-conflicts-in-ability-allowed' into 'master'
Move abilities by subject class to a dedicated method ## What does this MR do? Twin of gitlab-org/gitlab-ee!622. It moves the `case` that returns abilities depending on the subject class to a dedicated method. This should avoid lame conflicts when CE to EE since the EE version assign the result of the `case` to a variable. ## What are the relevant issue numbers? Closes #20621. See merge request !5668
-rw-r--r--app/models/ability.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/ability.rb b/app/models/ability.rb
index d95a2507199..d9113ffd99a 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -6,6 +6,10 @@ class Ability
return [] unless user.is_a?(User)
return [] if user.blocked?
+ abilities_by_subject_class(user: user, subject: subject)
+ end
+
+ def abilities_by_subject_class(user:, subject:)
case subject
when CommitStatus then commit_status_abilities(user, subject)
when Project then project_abilities(user, subject)