mirror of https://github.com/zulip/zulip.git
recent_topics_ui: Cut dependency on `muted_topics_ui.js`.
This commit is contained in:
parent
9447381d03
commit
65d49b5ad8
|
@ -22,7 +22,6 @@ import * as hashchange from "./hashchange";
|
||||||
import * as message_edit from "./message_edit";
|
import * as message_edit from "./message_edit";
|
||||||
import * as message_lists from "./message_lists";
|
import * as message_lists from "./message_lists";
|
||||||
import * as message_store from "./message_store";
|
import * as message_store from "./message_store";
|
||||||
import * as muted_topics_ui from "./muted_topics_ui";
|
|
||||||
import * as narrow from "./narrow";
|
import * as narrow from "./narrow";
|
||||||
import * as navigate from "./navigate";
|
import * as navigate from "./navigate";
|
||||||
import {page_params} from "./page_params";
|
import {page_params} from "./page_params";
|
||||||
|
@ -388,7 +387,7 @@ export function initialize() {
|
||||||
// Mute topic in a unmuted stream
|
// Mute topic in a unmuted stream
|
||||||
$("body").on("click", ".message_header .stream_unmuted.on_hover_topic_mute", (e) => {
|
$("body").on("click", ".message_header .stream_unmuted.on_hover_topic_mute", (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
muted_topics_ui.mute_or_unmute_topic(
|
user_topics.set_visibility_policy_for_element(
|
||||||
$(e.target),
|
$(e.target),
|
||||||
user_topics.all_visibility_policies.MUTED,
|
user_topics.all_visibility_policies.MUTED,
|
||||||
);
|
);
|
||||||
|
@ -397,7 +396,7 @@ export function initialize() {
|
||||||
// Unmute topic in a unmuted stream
|
// Unmute topic in a unmuted stream
|
||||||
$("body").on("click", ".message_header .stream_unmuted.on_hover_topic_unmute", (e) => {
|
$("body").on("click", ".message_header .stream_unmuted.on_hover_topic_unmute", (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
muted_topics_ui.mute_or_unmute_topic(
|
user_topics.set_visibility_policy_for_element(
|
||||||
$(e.target),
|
$(e.target),
|
||||||
user_topics.all_visibility_policies.INHERIT,
|
user_topics.all_visibility_policies.INHERIT,
|
||||||
);
|
);
|
||||||
|
@ -406,7 +405,7 @@ export function initialize() {
|
||||||
// Unmute topic in a muted stream
|
// Unmute topic in a muted stream
|
||||||
$("body").on("click", ".message_header .stream_muted.on_hover_topic_unmute", (e) => {
|
$("body").on("click", ".message_header .stream_muted.on_hover_topic_unmute", (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
muted_topics_ui.mute_or_unmute_topic(
|
user_topics.set_visibility_policy_for_element(
|
||||||
$(e.target),
|
$(e.target),
|
||||||
user_topics.all_visibility_policies.UNMUTED,
|
user_topics.all_visibility_policies.UNMUTED,
|
||||||
);
|
);
|
||||||
|
@ -415,7 +414,7 @@ export function initialize() {
|
||||||
// Mute topic in a muted stream
|
// Mute topic in a muted stream
|
||||||
$("body").on("click", ".message_header .stream_muted.on_hover_topic_mute", (e) => {
|
$("body").on("click", ".message_header .stream_muted.on_hover_topic_mute", (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
muted_topics_ui.mute_or_unmute_topic(
|
user_topics.set_visibility_policy_for_element(
|
||||||
$(e.target),
|
$(e.target),
|
||||||
user_topics.all_visibility_policies.INHERIT,
|
user_topics.all_visibility_policies.INHERIT,
|
||||||
);
|
);
|
||||||
|
|
|
@ -54,9 +54,3 @@ export function toggle_topic_visibility_policy(message) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mute_or_unmute_topic($elt, visibility_policy) {
|
|
||||||
const stream_id = Number.parseInt($elt.attr("data-stream-id"), 10);
|
|
||||||
const topic = $elt.attr("data-topic-name");
|
|
||||||
user_topics.set_user_topic_visibility_policy(stream_id, topic, visibility_policy);
|
|
||||||
}
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ import {localstorage} from "./localstorage";
|
||||||
import * as message_store from "./message_store";
|
import * as message_store from "./message_store";
|
||||||
import * as message_util from "./message_util";
|
import * as message_util from "./message_util";
|
||||||
import * as message_view_header from "./message_view_header";
|
import * as message_view_header from "./message_view_header";
|
||||||
import * as muted_topics_ui from "./muted_topics_ui";
|
|
||||||
import * as muted_users from "./muted_users";
|
import * as muted_users from "./muted_users";
|
||||||
import * as narrow from "./narrow";
|
import * as narrow from "./narrow";
|
||||||
import * as narrow_state from "./narrow_state";
|
import * as narrow_state from "./narrow_state";
|
||||||
|
@ -1271,7 +1270,10 @@ export function initialize() {
|
||||||
const $elt = $(e.target);
|
const $elt = $(e.target);
|
||||||
const topic_row_index = $elt.closest("tr").index();
|
const topic_row_index = $elt.closest("tr").index();
|
||||||
focus_clicked_element(topic_row_index, COLUMNS.mute);
|
focus_clicked_element(topic_row_index, COLUMNS.mute);
|
||||||
muted_topics_ui.mute_or_unmute_topic($elt, user_topics.all_visibility_policies.MUTED);
|
user_topics.set_visibility_policy_for_element(
|
||||||
|
$elt,
|
||||||
|
user_topics.all_visibility_policies.MUTED,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Unmute topic in a unmuted stream
|
// Unmute topic in a unmuted stream
|
||||||
|
@ -1280,7 +1282,10 @@ export function initialize() {
|
||||||
const $elt = $(e.target);
|
const $elt = $(e.target);
|
||||||
const topic_row_index = $elt.closest("tr").index();
|
const topic_row_index = $elt.closest("tr").index();
|
||||||
focus_clicked_element(topic_row_index, COLUMNS.mute);
|
focus_clicked_element(topic_row_index, COLUMNS.mute);
|
||||||
muted_topics_ui.mute_or_unmute_topic($elt, user_topics.all_visibility_policies.INHERIT);
|
user_topics.set_visibility_policy_for_element(
|
||||||
|
$elt,
|
||||||
|
user_topics.all_visibility_policies.INHERIT,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Unmute topic in a muted stream
|
// Unmute topic in a muted stream
|
||||||
|
@ -1289,7 +1294,10 @@ export function initialize() {
|
||||||
const $elt = $(e.target);
|
const $elt = $(e.target);
|
||||||
const topic_row_index = $elt.closest("tr").index();
|
const topic_row_index = $elt.closest("tr").index();
|
||||||
focus_clicked_element(topic_row_index, COLUMNS.mute);
|
focus_clicked_element(topic_row_index, COLUMNS.mute);
|
||||||
muted_topics_ui.mute_or_unmute_topic($elt, user_topics.all_visibility_policies.UNMUTED);
|
user_topics.set_visibility_policy_for_element(
|
||||||
|
$elt,
|
||||||
|
user_topics.all_visibility_policies.UNMUTED,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mute topic in a muted stream
|
// Mute topic in a muted stream
|
||||||
|
@ -1298,7 +1306,10 @@ export function initialize() {
|
||||||
const $elt = $(e.target);
|
const $elt = $(e.target);
|
||||||
const topic_row_index = $elt.closest("tr").index();
|
const topic_row_index = $elt.closest("tr").index();
|
||||||
focus_clicked_element(topic_row_index, COLUMNS.mute);
|
focus_clicked_element(topic_row_index, COLUMNS.mute);
|
||||||
muted_topics_ui.mute_or_unmute_topic($elt, user_topics.all_visibility_policies.INHERIT);
|
user_topics.set_visibility_policy_for_element(
|
||||||
|
$elt,
|
||||||
|
user_topics.all_visibility_policies.INHERIT,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("body").on("click", "#recent_topics_search", (e) => {
|
$("body").on("click", "#recent_topics_search", (e) => {
|
||||||
|
|
|
@ -136,6 +136,12 @@ export function set_user_topic_visibility_policy(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function set_visibility_policy_for_element($elt, visibility_policy) {
|
||||||
|
const stream_id = Number.parseInt($elt.attr("data-stream-id"), 10);
|
||||||
|
const topic = $elt.attr("data-topic-name");
|
||||||
|
set_user_topic_visibility_policy(stream_id, topic, visibility_policy);
|
||||||
|
}
|
||||||
|
|
||||||
export function set_user_topic(user_topic) {
|
export function set_user_topic(user_topic) {
|
||||||
const stream_id = user_topic.stream_id;
|
const stream_id = user_topic.stream_id;
|
||||||
const topic = user_topic.topic_name;
|
const topic = user_topic.topic_name;
|
||||||
|
|
Loading…
Reference in New Issue