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.

message_events: Remove topic with no messages from history.

Aman Agrawal794fde780b72
diff --git a/web/src/message_events.ts b/web/src/message_events.ts
index 76137c85511..094af3d0eca 100644
--- a/web/src/message_events.ts
+++ b/web/src/message_events.ts
@@ -734,9 +734,13 @@ export function update_messages(events: UpdateMessageEvent[]): void {
// TODO: Update the cache instead of discarding it.
message_list_data_cache.remove(new_filter);
const terms = new_filter.terms();
+ // If all the message in the topic were moved, we don't need to
+ // keep the current hash in the history.
+ const remove_current_hash_from_history = event.propagate_mode === "change_all";
const opts = {
trigger: "stream/topic change",
then_select_id: current_selected_id,
+ remove_current_hash_from_history,
};
message_view.show(terms, opts);
}
diff --git a/web/src/message_view.ts b/web/src/message_view.ts
index 7fd4ff3b5a6..9a658187d1e 100644
--- a/web/src/message_view.ts
+++ b/web/src/message_view.ts
@@ -114,6 +114,7 @@ export function changehash(
if (remove_current_hash_from_history) {
switch (trigger) {
case "retarget topic location":
+ case "stream/topic change":
// It is important to use `replaceState` rather than `replace`
// here for the `back` button to work; we don't want to use
// any metadata potentially stored by