stream: Only realm admins can post to an announcement_only streams.

If a non-admin tries to post to an announcement_only stream, error
message will be shown.
This commit is contained in:
Shubham Padia
2018-05-12 10:29:53 +05:30
committed by Tim Abbott
parent a5759108d3
commit bb8577ba94
2 changed files with 41 additions and 0 deletions

View File

@@ -1937,6 +1937,9 @@ def check_message(sender: UserProfile, client: Client, addressee: Addressee,
raise StreamDoesNotExistError(escape(stream_name))
recipient = get_stream_recipient(stream.id)
if stream.is_announcement_only and not sender.is_realm_admin:
raise JsonableError(_("Only organization administrators can send to this stream."))
if not stream.invite_only:
# This is a public stream
pass