Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

refactor: Extract `RESOLVED_TOPIC_PREFIX` in message_edit.js.

akshatdaltond17e5d080c42
diff --git a/static/js/message_edit.js b/static/js/message_edit.js
index c401e17ecf9..f0581f62c23 100644
--- a/static/js/message_edit.js
+++ b/static/js/message_edit.js
@@ -34,6 +34,7 @@ const currently_editing_messages = new Map();
let currently_deleting_messages = [];
let currently_topic_editing_messages = [];
const currently_echoing_messages = new Map();
+export const RESOLVED_TOPIC_PREFIX = "✔ ";
// These variables are designed to preserve the user's most recent
// choices when editing a group of messages, to make it convenient to
diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js
index e9f686de071..25471aaacb7 100644
--- a/static/js/stream_popover.js
+++ b/static/js/stream_popover.js
@@ -34,7 +34,6 @@ import * as sub_store from "./sub_store";
import * as subs from "./subs";
import * as unread_ops from "./unread_ops";
-const RESOLVED_TOPIC_PREFIX = "✔ ";
// We handle stream popovers and topic popovers in this
// module. Both are popped up from the left sidebar.
let current_stream_sidebar_elem;
@@ -276,7 +275,7 @@ function build_topic_popover(opts) {
topic_muted,
can_move_topic,
is_realm_admin: page_params.is_admin,
- topic_is_resolved: topic_name.startsWith(RESOLVED_TOPIC_PREFIX),
+ topic_is_resolved: topic_name.startsWith(message_edit.RESOLVED_TOPIC_PREFIX),
color: sub.color,
has_starred_messages,
});
@@ -685,7 +684,7 @@ export function register_topic_handlers() {
function mark_topic_as_resolved(stream_id, topic_name) {
const request = {
propagate_mode: "change_all",
- topic: RESOLVED_TOPIC_PREFIX + topic_name,
+ topic: message_edit.RESOLVED_TOPIC_PREFIX + topic_name,
send_notification_to_old_thread: false,
send_notification_to_new_thread: true,
};
@@ -700,7 +699,7 @@ export function register_topic_handlers() {
function mark_topic_as_unresolved(stream_id, topic_name) {
const request = {
propagate_mode: "change_all",
- topic: _.trimStart(topic_name, RESOLVED_TOPIC_PREFIX),
+ topic: _.trimStart(topic_name, message_edit.RESOLVED_TOPIC_PREFIX),
send_notification_to_old_thread: false,
send_notification_to_new_thread: true,
};
@@ -716,7 +715,7 @@ export function register_topic_handlers() {
const topic_row = $(e.currentTarget);
const stream_id = Number.parseInt(topic_row.attr("data-stream-id"), 10);
const topic_name = topic_row.attr("data-topic-name");
- if (topic_name.startsWith(RESOLVED_TOPIC_PREFIX)) {
+ if (topic_name.startsWith(message_edit.RESOLVED_TOPIC_PREFIX)) {
mark_topic_as_unresolved(stream_id, topic_name);
} else {
mark_topic_as_resolved(stream_id, topic_name);