mirror of https://github.com/zulip/zulip.git
settings_user_topics: Fix implicit use of any.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
939b88b9a7
commit
2be5cb0223
|
@ -61,26 +61,30 @@ export function populate_list(): void {
|
|||
export function set_up(): void {
|
||||
loaded = true;
|
||||
|
||||
$("body").on("change", ".settings_user_topic_visibility_policy", function (e) {
|
||||
const $row = $(this).closest("tr");
|
||||
const stream_id_string = $row.attr("data-stream-id");
|
||||
assert(stream_id_string !== undefined);
|
||||
const stream_id = Number.parseInt(stream_id_string, 10);
|
||||
const topic = $row.attr("data-topic");
|
||||
assert(topic !== undefined);
|
||||
const visibility_policy = this.value;
|
||||
$("body").on(
|
||||
"change",
|
||||
"select.settings_user_topic_visibility_policy",
|
||||
function (this: HTMLSelectElement, e) {
|
||||
const $row = $(this).closest("tr");
|
||||
const stream_id_string = $row.attr("data-stream-id");
|
||||
assert(stream_id_string !== undefined);
|
||||
const stream_id = Number.parseInt(stream_id_string, 10);
|
||||
const topic = $row.attr("data-topic");
|
||||
assert(topic !== undefined);
|
||||
const visibility_policy = Number(this.value);
|
||||
|
||||
e.stopPropagation();
|
||||
e.stopPropagation();
|
||||
|
||||
user_topics.set_user_topic_visibility_policy(
|
||||
stream_id,
|
||||
topic,
|
||||
visibility_policy,
|
||||
false,
|
||||
false,
|
||||
$row.closest("#user-topic-settings").find(".alert-notification"),
|
||||
);
|
||||
});
|
||||
user_topics.set_user_topic_visibility_policy(
|
||||
stream_id,
|
||||
topic,
|
||||
visibility_policy,
|
||||
false,
|
||||
false,
|
||||
$row.closest("#user-topic-settings").find(".alert-notification"),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
populate_list();
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ run_test("settings", ({override, override_rewire}) => {
|
|||
|
||||
const topic_change_handler = $("body").get_on_handler(
|
||||
"change",
|
||||
".settings_user_topic_visibility_policy",
|
||||
"select.settings_user_topic_visibility_policy",
|
||||
);
|
||||
assert.equal(typeof topic_change_handler, "function");
|
||||
|
||||
|
@ -104,8 +104,11 @@ run_test("settings", ({override, override_rewire}) => {
|
|||
user_topic_visibility_policy_changed = true;
|
||||
},
|
||||
);
|
||||
$topic_fake_this.value = user_topics.all_visibility_policies.UNMUTED;
|
||||
topic_change_handler.call($topic_fake_this, event);
|
||||
const topic_fake_this = {
|
||||
to_$: () => $topic_fake_this,
|
||||
value: user_topics.all_visibility_policies.UNMUTED,
|
||||
};
|
||||
topic_change_handler.call(topic_fake_this, event);
|
||||
assert.ok(user_topic_visibility_policy_changed);
|
||||
assert.equal(topic_data_called, 2);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue