stream_setting: Add setting for who can move messages out of channel.

Adds `can_move_messages_out_of_channel_group` channel-level
permission for who can move messages out of the channel.

Fixes #34243.
This commit is contained in:
Vector73
2025-06-24 06:55:35 +00:00
committed by Tim Abbott
parent 703601a5d5
commit b612351e48
30 changed files with 460 additions and 20 deletions

View File

@@ -56,6 +56,7 @@ from zerver.lib.streams import (
access_stream_by_id_for_message,
can_access_stream_history,
can_edit_topic,
can_move_messages_out_of_channel,
check_stream_access_based_on_can_send_message_group,
get_stream_topics_policy,
notify_stream_is_recently_active_update,
@@ -1561,7 +1562,7 @@ def check_update_message(
if isinstance(message_edit_request, StreamMessageEditRequest):
if message_edit_request.is_stream_edited:
assert message.is_stream_message()
if not user_profile.can_move_messages_between_streams():
if not can_move_messages_out_of_channel(user_profile, message_edit_request.orig_stream):
raise JsonableError(_("You don't have permission to move this message"))
check_stream_access_based_on_can_send_message_group(

View File

@@ -458,6 +458,9 @@ def send_subscription_add_events(
is_archived=stream_dict["is_archived"],
can_add_subscribers_group=stream_dict["can_add_subscribers_group"],
can_administer_channel_group=stream_dict["can_administer_channel_group"],
can_move_messages_out_of_channel_group=stream_dict[
"can_move_messages_out_of_channel_group"
],
can_move_messages_within_channel_group=stream_dict[
"can_move_messages_within_channel_group"
],