From 10b045f91b4053f75d2cedff20b57f35a9224308 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 13 Dec 2018 22:23:50 +0000 Subject: [PATCH] muting: Use stream_id as arg for notify_with_undo_option. Also remove the unused meta.stream and meta.topic variables. --- static/js/muting_ui.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/static/js/muting_ui.js b/static/js/muting_ui.js index 8f5ef94075..8f5921dd5c 100644 --- a/static/js/muting_ui.js +++ b/static/js/muting_ui.js @@ -25,8 +25,6 @@ exports.rerender = function () { exports.notify_with_undo_option = (function () { var meta = { - stream: null, - topic: null, hide_me_time: null, alert_hover_state: false, $mute: null, @@ -49,7 +47,9 @@ exports.notify_with_undo_option = (function () { } }, 100); - return function (stream, topic) { + return function (stream_id, topic) { + var stream_name = stream_data.maybe_get_stream_name(stream_id); + var $exit = $("#unmute_muted_topic_notification .exit-me"); if (!meta.$mute) { @@ -62,18 +62,16 @@ exports.notify_with_undo_option = (function () { meta.$mute.find("#unmute").click(function () { // it should reference the meta variable and not get stuck with // a pass-by-value of stream, topic. - exports.unmute(meta.stream, meta.topic); + exports.unmute(stream_name, topic); animate.fadeOut(); }); } - meta.stream = stream; - meta.topic = topic; // add a four second delay before closing up. meta.hide_me_time = new Date().getTime() + 4000; + meta.$mute.find(".stream").text(stream_name); meta.$mute.find(".topic").text(topic); - meta.$mute.find(".stream").text(stream); animate.fadeIn(); @@ -180,7 +178,7 @@ exports.mute = function (stream, topic) { unread_ui.update_unread_counts(); exports.rerender(); exports.persist_mute(stream_id, topic); - exports.notify_with_undo_option(stream, topic); + exports.notify_with_undo_option(stream_id, topic); exports.set_up_muted_topics_ui(muting.get_muted_topics()); };