mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 16:37:23 +00:00
delete_sub: Do not remove archived stream when deactivated.
Stream is simply marked as `archived: true` instead of removing the stream from `sub_store` and `stream_info`. A check in `subscribe_myself` is added before subscribing to a stream.
This commit is contained in:
@@ -143,6 +143,10 @@ export function rename_sub(sub: StreamSubscription, new_name: string): void {
|
||||
}
|
||||
|
||||
export function subscribe_myself(sub: StreamSubscription): void {
|
||||
if (sub.is_archived) {
|
||||
blueslip.warn("Can't subscribe to an archived stream.");
|
||||
return;
|
||||
}
|
||||
const user_id = people.my_current_user_id();
|
||||
peer_data.add_subscriber(sub.stream_id, user_id);
|
||||
sub.subscribed = true;
|
||||
@@ -297,12 +301,13 @@ export function slug_to_stream_id(slug: string): number | undefined {
|
||||
}
|
||||
|
||||
export function delete_sub(stream_id: number): void {
|
||||
if (!stream_info.get(stream_id)) {
|
||||
const sub = get_sub_by_id(stream_id);
|
||||
if (sub === undefined || !stream_info.get(stream_id)) {
|
||||
blueslip.warn("Failed to archive stream " + stream_id.toString());
|
||||
return;
|
||||
}
|
||||
sub_store.delete_sub(stream_id);
|
||||
stream_info.delete(stream_id);
|
||||
sub.is_archived = true;
|
||||
stream_info.set_false(stream_id, sub);
|
||||
}
|
||||
|
||||
export function get_non_default_stream_names(): {name: string; unique_id: number}[] {
|
||||
|
||||
Reference in New Issue
Block a user