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 @@ -376,6 +376,19 @@ class ZulipStream {
376
376
_$ZulipStreamFromJson (json);
377
377
378
378
Map <String , dynamic > toJson () => _$ZulipStreamToJson (this );
379
+
380
+ bool hasPostingPermission (User user, {required int realmWaitingPeriodThreshold}) {
381
+ final role = user.role;
382
+ return switch (channelPostPolicy) {
383
+ ChannelPostPolicy .any => true ,
384
+ ChannelPostPolicy .fullMembers => role != UserRole .guest && (role == UserRole .member
385
+ ? user.isFullMember (realmWaitingPeriodThreshold)
386
+ : true ),
387
+ ChannelPostPolicy .moderators => role != UserRole .guest && role != UserRole .member,
388
+ ChannelPostPolicy .administrators => role == UserRole .administrator || role == UserRole .owner || role == UserRole .unknown,
389
+ ChannelPostPolicy .unknown => true ,
390
+ };
391
+ }
379
392
}
380
393
381
394
/// Policy for which users can post to the stream.
You can’t perform that action at this time.
0 commit comments