BigW Consortium Gitlab

Commit c298068c by Jacob Schatz

Fix underlying issue with emoji reactions

Issue was: blank space was rendering as a element in an array of authors. Element was being used by `join`. Original fix !2450 was trying to remove the space after it happened. This checks properly for it and only moves forward if it does not exist. Also removes "me" upon unchecking emoji.
parent 419bff80
...@@ -44,8 +44,7 @@ class @AwardsHandler ...@@ -44,8 +44,7 @@ class @AwardsHandler
decrementCounter: (emoji) -> decrementCounter: (emoji) ->
counter = @findEmojiIcon(emoji).siblings(".counter") counter = @findEmojiIcon(emoji).siblings(".counter")
emojiIcon = counter.parent() emojiIcon = counter.parent()
if parseInt(counter.text()) > 0
if parseInt(counter.text()) > 1
counter.text(parseInt(counter.text()) - 1) counter.text(parseInt(counter.text()) - 1)
emojiIcon.removeClass("active") emojiIcon.removeClass("active")
@removeMeFromAuthorList(emoji) @removeMeFromAuthorList(emoji)
...@@ -60,16 +59,19 @@ class @AwardsHandler ...@@ -60,16 +59,19 @@ class @AwardsHandler
removeMeFromAuthorList: (emoji) -> removeMeFromAuthorList: (emoji) ->
award_block = @findEmojiIcon(emoji).parent() award_block = @findEmojiIcon(emoji).parent()
authors = award_block.attr("data-original-title").split(", ") authors = award_block.attr("data-original-title").split(", ")
authors = _.without(authors, "me").join(", ") if authors.indexOf("me") != -1
award_block.attr("title", authors) authors.splice(authors.indexOf("me"),1)
award_block.closest(".award").attr("data-original-title", authors.join(", "))
@resetTooltip(award_block) @resetTooltip(award_block)
addMeToAuthorList: (emoji) -> addMeToAuthorList: (emoji) ->
award_block = @findEmojiIcon(emoji).parent() award_block = @findEmojiIcon(emoji).parent()
authors = award_block.attr("data-original-title").trim().split(", ") origTitle = award_block.attr("data-original-title").trim()
authors = []
if origTitle
authors = origTitle.split(', ')
if authors.indexOf("me") == -1 if authors.indexOf("me") == -1
authors.push("me") authors.push("me")
console.log('authors');
award_block.attr("title", authors.join(", ")) award_block.attr("title", authors.join(", "))
@resetTooltip(award_block) @resetTooltip(award_block)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment