diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-06-28 07:48:29 +0000 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2019-06-28 07:48:29 +0000 |
commit | f59a34a15f28a840670fa2fef5801aa31856d67b (patch) | |
tree | 7e0e53dfbeee535e93fdebcdd92f157d5d6997e7 /app/policies | |
parent | 83ae09ad63c4b5e2a4c7c125961cc4a69bf22513 (diff) | |
parent | 4b9b2a43d02fc5154f780ade7fe76c02420fff15 (diff) | |
download | gitlab-ce-f59a34a15f28a840670fa2fef5801aa31856d67b.tar.gz |
Merge branch '62826-graphql-emoji-mutations' into 'master'
GraphQL mutations for add, remove and toggle emoji
See merge request gitlab-org/gitlab-ce!29919
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/award_emoji_policy.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/policies/award_emoji_policy.rb b/app/policies/award_emoji_policy.rb new file mode 100644 index 00000000000..21e382e24b3 --- /dev/null +++ b/app/policies/award_emoji_policy.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AwardEmojiPolicy < BasePolicy + delegate { @subject.awardable if DeclarativePolicy.has_policy?(@subject.awardable) } + + condition(:can_read_awardable) do + can?(:"read_#{@subject.awardable.to_ability_name}") + end + + rule { can_read_awardable }.enable :read_emoji +end |