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.

inline_topic_edit: Trim the new_topic value entered by user.

Prakhar Pratyushfdd0a5ba2c19
diff --git a/web/src/message_edit.ts b/web/src/message_edit.ts
index 33f6427d2f2..8eab1e01d8c 100644
--- a/web/src/message_edit.ts
+++ b/web/src/message_edit.ts
@@ -963,9 +963,9 @@ export function try_save_inline_topic_edit($row: JQuery): void {
const message = message_lists.current.get(message_id);
assert(message?.type === "stream");
const old_topic = message.topic;
- const new_topic = $row.find<HTMLInputElement>("input.inline_topic_edit").val();
+ const new_topic = $row.find<HTMLInputElement>("input.inline_topic_edit").val()?.trim();
assert(new_topic !== undefined);
- const topic_changed = new_topic !== old_topic && new_topic.trim() !== "";
+ const topic_changed = new_topic !== old_topic && new_topic !== "";
if (!topic_changed) {
// this means the inline_topic_edit was opened and submitted without