summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <zegerjan@gitlab.com>2016-05-11 22:43:58 +0200
committerZeger-Jan van de Weg <zegerjan@gitlab.com>2016-05-11 22:43:58 +0200
commit4558b5b9fe9f648903ad0dc01089e6118fe0af34 (patch)
tree36903f41d1f773de3c8fc69592b714b8d9390e0f /app/services
parent2f0d89ecff652418a8323990248b681a91f8e05b (diff)
downloadgitlab-ce-4558b5b9fe9f648903ad0dc01089e6118fe0af34.tar.gz
Incorporate feedback
Diffstat (limited to 'app/services')
-rw-r--r--app/services/notes/create_service.rb2
-rw-r--r--app/services/toggle_award_emoji_service.rb12
2 files changed, 1 insertions, 13 deletions
diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb
index da2a774b70d..bbf7889166d 100644
--- a/app/services/notes/create_service.rb
+++ b/app/services/notes/create_service.rb
@@ -7,7 +7,7 @@ module Notes
if note.award_emoji?
return ToggleAwardEmojiService.new(project, current_user, params).
- execute(note.noteable, note.note)
+ execute(note.award_emoji_name, note.note)
end
return unless valid_project?(note)
diff --git a/app/services/toggle_award_emoji_service.rb b/app/services/toggle_award_emoji_service.rb
index b77b4e79bf2..1820f57f564 100644
--- a/app/services/toggle_award_emoji_service.rb
+++ b/app/services/toggle_award_emoji_service.rb
@@ -1,21 +1,9 @@
require_relative 'base_service'
class ToggleAwardEmojiService < BaseService
- # For an award emoji being posted we should:
- # - Mark the TODO as done for this issuable (skip on snippets)
- # - Save the award emoji
def execute(awardable, emoji)
todo_service.new_award_emoji(awardable, current_user)
- # Needed if its posted as a note containing only :+1:
- emoji = award_emoji_name(emoji) if emoji.start_with? ':'
awardable.toggle_award_emoji(emoji, current_user)
end
-
- private
-
- def award_emoji_name(emoji)
- original_name = emoji.match(Banzai::Filter::EmojiFilter.emoji_pattern)[1]
- Gitlab::AwardEmoji.normalize_emoji_name(original_name)
- end
end