diff options
author | Grzegorz Bizon <grzegorz.bizon@ntsn.pl> | 2015-12-02 08:48:21 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzegorz.bizon@ntsn.pl> | 2015-12-03 13:38:59 +0100 |
commit | ba08811d07cd1804b027b1a37a5278723cdbeb2c (patch) | |
tree | 21c333743edb9925959b6a7a4e252fe28b6b1051 /app/services | |
parent | 22d87b74a9de5d603f101699d7a3665db9627037 (diff) | |
download | gitlab-ce-ba08811d07cd1804b027b1a37a5278723cdbeb2c.tar.gz |
Move note emoji-award implementation to note model (feature envy)
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/notes/create_service.rb | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb index 20a3ba30755..a8486e6a5a1 100644 --- a/app/services/notes/create_service.rb +++ b/app/services/notes/create_service.rb @@ -5,11 +5,6 @@ module Notes note.author = current_user note.system = false - if award_emoji_note? - note.is_award = true - note.note = emoji_name - end - if note.save notification_service.new_note(note) @@ -33,24 +28,5 @@ module Notes note.project.execute_hooks(note_data, :note_hooks) note.project.execute_services(note_data, :note_hooks) end - - private - - def award_emoji_note? - # We support award-emojis only in issue discussion - issue_comment? && contains_emoji_only? - end - - def contains_emoji_only? - params[:note] =~ /\A:[-_+[:alnum:]]*:\s?\z/ - end - - def issue_comment? - params[:noteable_type] == 'Issue' - end - - def emoji_name - params[:note].match(/\A:([-_+[:alnum:]]*):\s?/)[1] - end end end |