Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbarthc <mackintosh02@gmail.com>2016-08-17 14:21:06 +0300
committerbarthc <mackintosh02@gmail.com>2016-08-28 20:15:55 +0300
commit76872372376e57cd7d55ba9b9c63b25fe53c82df (patch)
tree1d7a93bd75644fdecd292e835b46c80046e4b222 /lib/api/award_emoji.rb
parent68b3c8c2973a8fe1ee3f51091394acef2a25789d (diff)
prevent authored awardable thumbs votes
prevent authored awardable thumbs votes prevent authored awardable thumbs votes
Diffstat (limited to 'lib/api/award_emoji.rb')
-rw-r--r--lib/api/award_emoji.rb6
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