summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-11-20 11:13:43 +0200
committerValery Sizov <vsv2711@gmail.com>2015-11-20 11:13:43 +0200
commitf31ee525070d335aba8a189b304e3c446aedf1fb (patch)
tree99f2a1ea4291e22903e35d5d4add04de557a7709
parent225bbf84edc2f809a9212379b5e527f14058d2b8 (diff)
downloadgitlab-ce-notes_fix.tar.gz
-rw-r--r--app/assets/javascripts/awards_handler.coffee2
-rw-r--r--app/controllers/projects/notes_controller.rb2
-rw-r--r--app/helpers/issues_helper.rb2
-rw-r--r--app/services/notes/create_service.rb4
4 files changed, 6 insertions, 4 deletions
diff --git a/app/assets/javascripts/awards_handler.coffee b/app/assets/javascripts/awards_handler.coffee
index ae42e390c43..635c9b4f8d2 100644
--- a/app/assets/javascripts/awards_handler.coffee
+++ b/app/assets/javascripts/awards_handler.coffee
@@ -80,7 +80,7 @@ class @AwardsHandler
postEmoji: (emoji, callback) ->
$.post @post_emoji_url, { note: {
- note: emoji
+ note: ":" + emoji + ":"
noteable_type: @noteable_type
noteable_id: @noteable_id
}},(data) ->
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb
index 263b8b8d94e..1e3f1d8fd2f 100644
--- a/app/controllers/projects/notes_controller.rb
+++ b/app/controllers/projects/notes_controller.rb
@@ -65,7 +65,7 @@ class Projects::NotesController < Projects::ApplicationController
data = {
author: current_user,
is_award: true,
- note: note_params[:note]
+ note: note_params[:note].gsub(":", '')
}
note = noteable.notes.find_by(data)
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 2c791aa5682..493f370d9a9 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -90,6 +90,8 @@ module IssuesHelper
def url_to_emoji(name)
emoji_path = ::AwardEmoji.path_to_emoji_image(name)
url_to_image(emoji_path)
+ rescue StandardError
+ ""
end
def emoji_author_list(notes, current_user)
diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb
index 25a985df4d8..dbff58dfb9c 100644
--- a/app/services/notes/create_service.rb
+++ b/app/services/notes/create_service.rb
@@ -35,11 +35,11 @@ module Notes
end
def contains_emoji_only?(note)
- note =~ /\A:?[-_+[:alnum:]]*:?\s?\z/
+ note =~ /\A:[-_+[:alnum:]]*:\s?\z/
end
def emoji_name(note)
- note.match(/\A:?([-_+[:alnum:]]*):?\s?/)[1]
+ note.match(/\A:([-_+[:alnum:]]*):\s?/)[1]
end
end
end