File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,18 @@ class User {
263
263
factory User .fromJson (Map <String , dynamic > json) => _$UserFromJson (json);
264
264
265
265
Map <String , dynamic > toJson () => _$UserToJson (this );
266
+
267
+ /// Whether the user has passed the realm's waiting period to be a full member.
268
+ ///
269
+ /// See:
270
+ /// https://zulip.com/api/roles-and-permissions#determining-if-a-user-is-a-full-member
271
+ ///
272
+ /// To determine if a user is a full member, callers must also check that the
273
+ /// user's role is at least Role.Member.
274
+ bool hasPassedWaitingPeriod (DateTime byDate, int realmWaitingPeriodThreshold) {
275
+ final dateJoined = DateTime .parse (this .dateJoined);
276
+ return byDate.difference (dateJoined).inDays >= realmWaitingPeriodThreshold;
277
+ }
266
278
}
267
279
268
280
/// As in [User.profileData] .
You can’t perform that action at this time.
0 commit comments