mirror of
https://github.com/zulip/zulip.git
synced 2025-10-30 03:23:50 +00:00
message: Check stream_post_policy when moving messages between streams.
Previously only admins were allowed to move messages between streams and admins are allowed to post in any stream irresepctive of stream post policy, so there was no need to check for stream post policy. But as we now allow other members to also move messages, we need to check whether the user who is moving the message is allowed to post to the target stream (i.e. stream to which the messages are being moved) and thus we allow moving messages only if the user is allowed to post in target stream.
This commit is contained in:
@@ -143,6 +143,7 @@ from zerver.lib.streams import (
|
||||
access_stream_by_id,
|
||||
access_stream_for_send_message,
|
||||
can_access_stream_user_ids,
|
||||
check_stream_access_based_on_stream_post_policy,
|
||||
check_stream_name,
|
||||
create_stream_if_needed,
|
||||
get_default_value_for_history_public_to_subscribers,
|
||||
@@ -2816,6 +2817,7 @@ def check_update_message(
|
||||
raise JsonableError(_("Cannot change message content while changing stream"))
|
||||
|
||||
new_stream = access_stream_by_id(user_profile, stream_id, require_active=True)[0]
|
||||
check_stream_access_based_on_stream_post_policy(user_profile, new_stream)
|
||||
|
||||
number_changed = do_update_message(
|
||||
user_profile,
|
||||
|
||||
Reference in New Issue
Block a user