Move abilities by subject class to a dedicated method

This will avoid lame conflicts when merging CE to EE

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2016-08-04 16:00:31 +02:00
parent db69111a63
commit 705085db0c
No known key found for this signature in database
GPG key ID: 46DF07E5CD9E96AB

View file

@ -6,6 +6,10 @@ class Ability
return [] unless user.is_a?(User) return [] unless user.is_a?(User)
return [] if user.blocked? return [] if user.blocked?
abilities_by_subject_class(user: user, subject: subject)
end
def abilities_by_subject_class(user:, subject:)
case subject case subject
when CommitStatus then commit_status_abilities(user, subject) when CommitStatus then commit_status_abilities(user, subject)
when Project then project_abilities(user, subject) when Project then project_abilities(user, subject)