Skip to content

Commit 6ebf48f

Browse files
committed
api: Drop is_cross_realm_bot fallback for User.isSystemBot, relying on server 5+, FL 83+
See "Feature level 83" from Zulip API changelog: https://zulip.com/api/changelog Signed-off-by: Zixuan James Li <[email protected]>
1 parent a33912d commit 6ebf48f

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

lib/api/model/model.dart

+3-9
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ class User {
221221
@JsonKey(readValue: _readProfileData)
222222
Map<int, ProfileFieldUserData>? profileData;
223223

224-
@JsonKey(readValue: _readIsSystemBot)
224+
// This field is absent in `realm_users` and `realm_non_active_users`,
225+
// which contain no system bots; it's present in `cross_realm_bots`.
226+
@JsonKey(defaultValue: false)
225227
final bool isSystemBot;
226228

227229
static Map<String, dynamic>? _readProfileData(Map<dynamic, dynamic> json, String key) {
@@ -233,14 +235,6 @@ class User {
233235
return (value != null && value.isNotEmpty) ? value : null;
234236
}
235237

236-
static bool _readIsSystemBot(Map<dynamic, dynamic> json, String key) {
237-
// This field is absent in `realm_users` and `realm_non_active_users`,
238-
// which contain no system bots; it's present in `cross_realm_bots`.
239-
return (json[key] as bool?)
240-
?? (json['is_cross_realm_bot'] as bool?) // TODO(server-5): renamed to `is_system_bot`
241-
?? false;
242-
}
243-
244238
User({
245239
required this.userId,
246240
required this.deliveryEmail,

lib/api/model/model.g.dart

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/api/model/model_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ void main() {
6262

6363
test('is_system_bot', () {
6464
check(mkUser({}).isSystemBot).isFalse();
65-
check(mkUser({'is_cross_realm_bot': true}).isSystemBot).isTrue();
6665
check(mkUser({'is_system_bot': true}).isSystemBot).isTrue();
6766
});
6867
});

0 commit comments

Comments
 (0)