Fix for Emoji

This commit is contained in:
Valery Sizov
2015-11-20 11:13:43 +02:00
parent 225bbf84ed
commit f31ee52507
4 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -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) ->
+1 -1
View File
@@ -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)
+2
View File
@@ -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)
+2 -2
View File
@@ -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