summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-04-22 17:01:53 +0100
committerPhil Hughes <me@iamphill.com>2016-04-22 17:01:53 +0100
commit319c9360551280f7345c5d16ffb34fe5e73a1598 (patch)
tree90668f844ad4310aa738146e0996262cd14fb073 /app
parentd5398e9656c1174d4d5be5a8cdad2a26d7587a27 (diff)
downloadgitlab-ce-319c9360551280f7345c5d16ffb34fe5e73a1598.tar.gz
Fixes issue with emoji comments not showing correct emoji image
Previously it would look for the unicode character inside the award menu. But this menu might not always be there. Now, the unicode characters are loaded onto the page in an array which the award emoji that looks in to get the correct emoji unicode character Fixes #15512
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/awards_handler.coffee14
-rw-r--r--app/views/votes/_votes_block.html.haml4
2 files changed, 5 insertions, 13 deletions
diff --git a/app/assets/javascripts/awards_handler.coffee b/app/assets/javascripts/awards_handler.coffee
index af4462ece38..a17867f8c9b 100644
--- a/app/assets/javascripts/awards_handler.coffee
+++ b/app/assets/javascripts/awards_handler.coffee
@@ -1,5 +1,5 @@
class @AwardsHandler
- constructor: (@get_emojis_url, @post_emoji_url, @noteable_type, @noteable_id, @aliases) ->
+ constructor: (@get_emojis_url, @post_emoji_url, @noteable_type, @noteable_id, @unicodes) ->
$(".js-add-award").on "click", (event) =>
event.stopPropagation()
event.preventDefault()
@@ -146,15 +146,7 @@ class @AwardsHandler
$('.award-control').tooltip()
resolveNameToCssClass: (emoji) ->
- emoji_icon = $(".emoji-menu-content [data-emoji='#{emoji}']")
-
- if emoji_icon.length > 0
- unicodeName = emoji_icon.data("unicode-name")
- else
- # Find by alias
- unicodeName = $(".emoji-menu-content [data-aliases*=':#{emoji}:']").data("unicode-name")
-
- "emoji-#{unicodeName}"
+ "emoji-#{@unicodes[emoji]}"
postEmoji: (emoji, callback) ->
$.post @post_emoji_url, { note: {
@@ -174,7 +166,7 @@ class @AwardsHandler
}, 200)
normilizeEmojiName: (emoji) ->
- @aliases[emoji] || emoji
+ emoji
addEmojiToFrequentlyUsedList: (emoji) ->
frequently_used_emojis = @getFrequentlyUsedEmojis()
diff --git a/app/views/votes/_votes_block.html.haml b/app/views/votes/_votes_block.html.haml
index dc249155b92..59e12798691 100644
--- a/app/views/votes/_votes_block.html.haml
+++ b/app/views/votes/_votes_block.html.haml
@@ -19,12 +19,12 @@
var post_emoji_url = "#{award_toggle_namespace_project_notes_path(@project.namespace, @project)}";
var noteable_type = "#{votable.class.name.underscore}";
var noteable_id = "#{votable.id}";
- var aliases = #{AwardEmoji.aliases.to_json};
+ var unicodes = #{AwardEmoji.unicode.to_json};
window.awards_handler = new AwardsHandler(
get_emojis_url,
post_emoji_url,
noteable_type,
noteable_id,
- aliases
+ unicodes
);