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