Commit af7e669e authored by Robert Speicher's avatar Robert Speicher

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
parents 1aba0668 705085db
...@@ -6,6 +6,10 @@ class Ability ...@@ -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)
......
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