Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
reactions: Remove emoji container when reaction count is 0.
whilstsomebody733ab5f2f8c5
diff --git a/web/src/reactions.ts b/web/src/reactions.tsindex 6a35f4f55d4..df3354f72d8 100644--- a/web/src/reactions.ts+++ b/web/src/reactions.ts@@ -468,9 +468,11 @@ export let remove_reaction_from_view = (}if (reaction_count === 0) {- // If this user was the only one reacting for this emoji, we simply- // remove the reaction and exit.- $reaction.remove();+ // If this user was the only one reacting for this emoji, we+ // remove the entire `message_reaction` template outer+ // container, and then update vote text in case we now have+ // few enough reactions to display names again.+ $reaction.parent(".message_reaction_container").remove();update_vote_text_on_message(message);return;}diff --git a/web/tests/reactions.test.cjs b/web/tests/reactions.test.cjsindex 527498412de..16a46d05a9f 100644--- a/web/tests/reactions.test.cjs+++ b/web/tests/reactions.test.cjs@@ -1259,15 +1259,13 @@ test("remove_reaction_from_view (last person to react)", ({override_rewire}) =>};const message_id = 507;+ const $reaction_container = $.create("stub-reaction-container");+const $our_reaction = stub_reaction(message_id, "unicode_emoji,1f3b1");- override_rewire(reactions, "find_reaction", (message_id_param, local_id) => {- assert.equal(message_id_param, message_id);- assert.equal(local_id, "unicode_emoji,1f3b1");- return $our_reaction;- });+ $our_reaction.parent = () => $reaction_container;let removed;- $our_reaction.remove = () => {+ $our_reaction.parent().remove = () => {removed = true;};