mirror of
https://github.com/zulip/zulip.git
synced 2026-06-30 21:11:04 +08:00
stream_events: Assume mark_unsusbscribed sub is defined.
THere's only one call to this function, which should have a defined `sub`, so we can enforce this through typescript instead of doing an `undefined` check.
This commit is contained in:
parent
12c18a026b
commit
8fff2fcd3c
@ -247,11 +247,8 @@ export function mark_subscribed(
|
||||
user_profile.update_user_profile_streams_list_for_users([people.my_current_user_id()]);
|
||||
}
|
||||
|
||||
export function mark_unsubscribed(sub: StreamSubscription | undefined): void {
|
||||
if (sub === undefined) {
|
||||
// We don't know about this stream
|
||||
return;
|
||||
} else if (sub.subscribed) {
|
||||
export function mark_unsubscribed(sub: StreamSubscription): void {
|
||||
if (sub.subscribed) {
|
||||
stream_data.unsubscribe_myself(sub);
|
||||
if (overlays.streams_open()) {
|
||||
stream_settings_ui.update_settings_for_unsubscribed(sub);
|
||||
|
||||
@ -277,11 +277,6 @@ test("update_property", ({override}) => {
|
||||
}
|
||||
});
|
||||
|
||||
test("marked_unsubscribed (code coverage)", () => {
|
||||
// We don't error for unsubscribed streams for some reason.
|
||||
stream_events.mark_unsubscribed(undefined);
|
||||
});
|
||||
|
||||
test("marked_(un)subscribed (early return)", () => {
|
||||
// The early-return prevents us from exploding or needing
|
||||
// to override functions with side effects
|
||||
|
||||
Loading…
Reference in New Issue
Block a user