diff options
author | barthc <mackintosh02@gmail.com> | 2016-08-17 12:21:06 +0100 |
---|---|---|
committer | barthc <mackintosh02@gmail.com> | 2016-08-28 18:15:55 +0100 |
commit | 76872372376e57cd7d55ba9b9c63b25fe53c82df (patch) | |
tree | 1d7a93bd75644fdecd292e835b46c80046e4b222 /lib/api | |
parent | 68b3c8c2973a8fe1ee3f51091394acef2a25789d (diff) | |
download | gitlab-ce-76872372376e57cd7d55ba9b9c63b25fe53c82df.tar.gz |
prevent authored awardable thumbs votes
prevent authored awardable thumbs votes
prevent authored awardable thumbs votes
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/award_emoji.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/api/award_emoji.rb b/lib/api/award_emoji.rb index 2efe7e3adf3..7c22b17e4e5 100644 --- a/lib/api/award_emoji.rb +++ b/lib/api/award_emoji.rb @@ -54,7 +54,7 @@ module API post endpoint do required_attributes! [:name] - not_found!('Award Emoji') unless can_read_awardable? + not_found!('Award Emoji') unless can_read_awardable? && can_award_awardable? award = awardable.create_award_emoji(params[:name], current_user) @@ -92,6 +92,10 @@ module API can?(current_user, ability, awardable) end + def can_award_awardable? + awardable.user_can_award?(current_user, params[:name]) + end + def awardable @awardable ||= begin |