File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -372,6 +372,19 @@ class ZulipStream {
372
372
_$ZulipStreamFromJson (json);
373
373
374
374
Map <String , dynamic > toJson () => _$ZulipStreamToJson (this );
375
+
376
+ bool hasPostingPermission (User user, {required int realmWaitingPeriodThreshold}) {
377
+ final role = user.role;
378
+ return switch (channelPostPolicy) {
379
+ ChannelPostPolicy .any => true ,
380
+ ChannelPostPolicy .fullMembers => role != UserRole .guest && (role == UserRole .member
381
+ ? user.isFullMember (realmWaitingPeriodThreshold)
382
+ : true ),
383
+ ChannelPostPolicy .moderators => role != UserRole .guest && role != UserRole .member,
384
+ ChannelPostPolicy .administrators => role == UserRole .administrator || role == UserRole .owner || role == UserRole .unknown,
385
+ ChannelPostPolicy .unknown => true ,
386
+ };
387
+ }
375
388
}
376
389
377
390
/// Policy for which users can post to the stream.
You can’t perform that action at this time.
0 commit comments