Skip to content

Commit 241f6d7

Browse files
committed
api: Drop isOwner, isAdmin, isGuest from User class
These are obsoleted by [User.role] (which dates to Zulip 4.0). We never looked at these fields, but had a latent bug because we weren't keeping them up to date on RealmUserUpdateEvent. To fix the bug, just stop having the fields around at all. (Later if we find we want booleans with these handy names, we can always add getters that just inspect [User.role].)
1 parent cca6f24 commit 241f6d7

File tree

4 files changed

+3
-18
lines changed

4 files changed

+3
-18
lines changed

lib/api/model/model.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ class User {
194194
String fullName;
195195
String dateJoined;
196196
bool isActive; // Really sometimes absent in /register, but we normalize that away; see [InitialSnapshot.realmUsers].
197-
bool isOwner;
198-
bool isAdmin;
199-
bool isGuest;
197+
// bool isOwner; // obsoleted by [role]; ignore
198+
// bool isAdmin; // obsoleted by [role]; ignore
199+
// bool isGuest; // obsoleted by [role]; ignore
200200
bool? isBillingAdmin; // TODO(server-5)
201201
bool isBot;
202202
int? botType; // TODO enum
@@ -240,9 +240,6 @@ class User {
240240
required this.fullName,
241241
required this.dateJoined,
242242
required this.isActive,
243-
required this.isOwner,
244-
required this.isAdmin,
245-
required this.isGuest,
246243
required this.isBillingAdmin,
247244
required this.isBot,
248245
required this.botType,

lib/api/model/model.g.dart

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

test/api/model/model_checks.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ extension UserChecks on Subject<User> {
88
Subject<String> get fullName => has((x) => x.fullName, 'fullName');
99
Subject<String> get dateJoined => has((x) => x.dateJoined, 'dateJoined');
1010
Subject<bool> get isActive => has((x) => x.isActive, 'isActive');
11-
Subject<bool> get isOwner => has((x) => x.isOwner, 'isOwner');
12-
Subject<bool> get isAdmin => has((x) => x.isAdmin, 'isAdmin');
13-
Subject<bool> get isGuest => has((x) => x.isGuest, 'isGuest');
1411
Subject<bool?> get isBillingAdmin => has((x) => x.isBillingAdmin, 'isBillingAdmin');
1512
Subject<bool> get isBot => has((x) => x.isBot, 'isBot');
1613
Subject<int?> get botType => has((x) => x.botType, 'botType');

test/example_data.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ User user({
8888
fullName: fullName ?? 'A user', // TODO generate example names
8989
dateJoined: '2023-04-28',
9090
isActive: isActive ?? true,
91-
isOwner: false,
92-
isAdmin: false,
93-
isGuest: false,
9491
isBillingAdmin: false,
9592
isBot: isBot ?? false,
9693
botType: null,

0 commit comments

Comments
 (0)