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.

stream-events: Handle update events for deprecated properties.

Sahil Batraa5e5a010fec4
diff --git a/web/src/stream_events.ts b/web/src/stream_events.ts
index 0b3fea5f49e..a4297268e51 100644
--- a/web/src/stream_events.ts
+++ b/web/src/stream_events.ts
@@ -86,6 +86,17 @@ export function update_property<P extends keyof UpdatableStreamProperties>(
return;
}
+ const deprecated_properties = ["is_announcement_only", "stream_post_policy"];
+ if (deprecated_properties.includes(property)) {
+ // Server sends events for updating "is_announcement_only" and
+ // "stream_post_policy" properties which are still used by
+ // legacy API clients. Since we do not have any client capabilities
+ // to control which clients should receive these events, these
+ // events are sent to all clients and we just do nothing on
+ // receiving events for these properties.
+ return;
+ }
+
if (Object.keys(realm.server_supported_permission_settings.stream).includes(property)) {
stream_settings_ui.update_stream_permission_group_setting(
stream_permission_group_settings_schema.parse(property),
diff --git a/web/tests/stream_events.test.cjs b/web/tests/stream_events.test.cjs
index b51dada3843..8291a690a36 100644
--- a/web/tests/stream_events.test.cjs
+++ b/web/tests/stream_events.test.cjs
@@ -284,6 +284,12 @@ test("update_property", ({override}) => {
assert.equal(args.sub.stream_id, stream_id);
assert.equal(args.val, 3);
}
+
+ // Test deprecated properties for coverage.
+ {
+ stream_events.update_property(stream_id, "stream_post_policy", 2);
+ stream_events.update_property(stream_id, "is_announcement_only", false);
+ }
});
test("marked_(un)subscribed (early return)", () => {