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.

get_subs_for_settings: Exclude archived streams from `All Streams` menu.

sanchi-ta91721529212
diff --git a/web/src/hash_util.ts b/web/src/hash_util.ts
index d3c6a0ff1a8..ccf554f4e13 100644
--- a/web/src/hash_util.ts
+++ b/web/src/hash_util.ts
@@ -223,14 +223,18 @@ export function validate_channels_settings_hash(hash: string): string {
const stream_id = Number.parseInt(section, 10);
const sub = sub_store.get(stream_id);
// There are a few situations where we can't display stream settings:
- // 1. This is a stream that's been archived. (sub=undefined)
+ // 1. This is a stream that's been archived. (sub.is_archived=true)
// 2. The stream ID is invalid. (sub=undefined)
// 3. The current user is a guest, and was unsubscribed from the stream
// stream in the current session. (In future sessions, the stream will
// not be in sub_store).
//
// In all these cases we redirect the user to 'subscribed' tab.
- if (sub === undefined || (page_params.is_guest && !stream_data.is_subscribed(stream_id))) {
+ if (
+ sub === undefined ||
+ sub.is_archived ||
+ (page_params.is_guest && !stream_data.is_subscribed(stream_id))
+ ) {
return channels_settings_section_url();
}
diff --git a/web/src/stream_settings_data.ts b/web/src/stream_settings_data.ts
index 660bf63a86a..d7cb664a8ae 100644
--- a/web/src/stream_settings_data.ts
+++ b/web/src/stream_settings_data.ts
@@ -63,7 +63,7 @@ function get_subs_for_settings(subs: StreamSubscription[]): SettingsSubscription
// delegating, so that we can more efficiently compute subscriber counts
// (in bulk). If that plan appears to have been aborted, feel free to
// inline this.
- return subs.map((sub) => get_sub_for_settings(sub));
+ return subs.filter((sub) => !sub.is_archived).map((sub) => get_sub_for_settings(sub));
}
export function get_updated_unsorted_subs(): SettingsSubscription[] {