Skip to content

Commit a77e181

Browse files
committed
api: Assume is_muted in subscription/update events; ignore in_home_view
See changelog for FL 139: `GET /get-events`: When a user mutes or unmutes their subscription to a stream, a `subscription` update event is now sent for the `is_muted` property and for the deprecated `in_home_view` property to support clients fully migrating to use the `is_muted` property. Prior to this feature level, only one event was sent to clients with the deprecated `in_home_view` property. Fixes-partly: zulip#1837
1 parent 8baf4b5 commit a77e181

File tree

5 files changed

+6
-20
lines changed

5 files changed

+6
-20
lines changed

lib/api/model/events.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,6 @@ class SubscriptionUpdateEvent extends SubscriptionEvent {
783783
assert(RegExp(r'^#[0-9a-f]{6}$').hasMatch(str));
784784
return 0xff000000 | int.parse(str.substring(1), radix: 16);
785785
case SubscriptionProperty.isMuted:
786-
case SubscriptionProperty.inHomeView:
787786
case SubscriptionProperty.pinToTop:
788787
case SubscriptionProperty.desktopNotifications:
789788
case SubscriptionProperty.audibleNotifications:
@@ -820,13 +819,18 @@ enum SubscriptionProperty {
820819
color,
821820

822821
isMuted,
823-
inHomeView,
824822
pinToTop,
825823
desktopNotifications,
826824
audibleNotifications,
827825
pushNotifications,
828826
emailNotifications,
829827
wildcardMentionsNotify,
828+
829+
/// A new, unrecognized property, or a deprecated one we don't use.
830+
///
831+
/// Could be `in_home_view`, deprecated in FL 139 (Server 6) but still sent
832+
/// as of CZO on 2025-10-03.
833+
// TODO(server-future) Remove `in_home_view` comment once it stops being sent.
830834
unknown;
831835

832836
static SubscriptionProperty fromRawString(String raw) => _byRawString[raw] ?? unknown;

lib/api/model/events.g.dart

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/api/model/model.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,6 @@ class Subscription extends ZulipStream {
792792

793793
bool pinToTop;
794794
bool isMuted;
795-
// final bool? inHomeView; // deprecated; ignore
796795

797796
/// As an int that dart:ui's Color constructor will take:
798797
/// <https://api.flutter.dev/flutter/dart-ui/Color/Color.html>

lib/model/channel.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,6 @@ class ChannelStoreImpl extends HasUserStore with ChannelStore {
473473
case SubscriptionProperty.isMuted:
474474
// TODO(#1255) update [MessageListView] if affected
475475
subscription.isMuted = event.value as bool;
476-
case SubscriptionProperty.inHomeView:
477-
subscription.isMuted = !(event.value as bool);
478476
case SubscriptionProperty.pinToTop:
479477
subscription.pinToTop = event.value as bool;
480478
case SubscriptionProperty.desktopNotifications:

test/model/channel_test.dart

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,6 @@ void main() {
121121
value: true));
122122
check(store.subscriptions[stream.streamId]!.isMuted).isTrue();
123123
});
124-
125-
test('SubscriptionProperty.inHomeView updates isMuted instead', () async {
126-
final store = eg.store(initialSnapshot: eg.initialSnapshot(
127-
streams: [stream],
128-
subscriptions: [eg.subscription(stream, isMuted: false)],
129-
));
130-
check(store.subscriptions[stream.streamId]!.isMuted).isFalse();
131-
132-
await store.handleEvent(SubscriptionUpdateEvent(id: 1,
133-
streamId: stream.streamId,
134-
property: SubscriptionProperty.inHomeView,
135-
value: false));
136-
check(store.subscriptions[stream.streamId]!.isMuted).isTrue();
137-
});
138124
});
139125

140126
group('topic visibility', () {

0 commit comments

Comments
 (0)