mirror of https://github.com/zulip/zulip.git
muted_topics: Rerender list only if modal is opened and section is loaded.
We should rernder the muted topics list in settings only if the settings modal is opened and the muted topics section is loaded.
This commit is contained in:
parent
c1b047b0d1
commit
d41f66a917
|
@ -32,7 +32,10 @@ run_test('settings', () => {
|
|||
set_up_ui_called = true;
|
||||
};
|
||||
|
||||
assert.equal(settings_muting.loaded, false);
|
||||
|
||||
settings_muting.set_up();
|
||||
assert.equal(settings_muting.loaded, true);
|
||||
|
||||
const click_handler = $('body').get_on_handler('click', '.settings-unmute-topic');
|
||||
assert.equal(typeof click_handler, 'function');
|
||||
|
@ -71,3 +74,8 @@ run_test('settings', () => {
|
|||
assert(set_up_ui_called);
|
||||
assert.equal(data_called, 2);
|
||||
});
|
||||
|
||||
run_test('reset', () => {
|
||||
settings_muting.reset();
|
||||
assert.equal(settings_muting.loaded, false);
|
||||
});
|
||||
|
|
|
@ -20,7 +20,9 @@ exports.rerender = function () {
|
|||
if (current_msg_list !== home_msg_list) {
|
||||
home_msg_list.update_muting_and_rerender();
|
||||
}
|
||||
exports.set_up_muted_topics_ui();
|
||||
if (overlays.settings_open() && settings_muting.loaded) {
|
||||
exports.set_up_muted_topics_ui();
|
||||
}
|
||||
};
|
||||
|
||||
exports.persist_mute = function (stream_id, topic_name) {
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
exports.loaded = false;
|
||||
|
||||
exports.set_up = function () {
|
||||
exports.loaded = true;
|
||||
$('body').on('click', '.settings-unmute-topic', function (e) {
|
||||
const $row = $(this).closest("tr");
|
||||
const stream_id = parseInt($row.attr("data-stream-id"), 10);
|
||||
|
@ -13,4 +16,8 @@ exports.set_up = function () {
|
|||
muting_ui.set_up_muted_topics_ui();
|
||||
};
|
||||
|
||||
exports.reset = function () {
|
||||
exports.loaded = false;
|
||||
};
|
||||
|
||||
window.settings_muting = exports;
|
||||
|
|
|
@ -77,6 +77,7 @@ exports.reset_sections = function () {
|
|||
settings_profile_fields.reset();
|
||||
settings_streams.reset();
|
||||
settings_user_groups.reset();
|
||||
settings_muting.reset();
|
||||
// settings_users doesn't need a reset()
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue