mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
message_edit: Pass old_stream to update_messages_for_topic_edit.
We'll need this for checking access to moved messages.
This commit is contained in:
@@ -5791,7 +5791,6 @@ def do_update_message(
|
||||
event["propagate_mode"] = propagate_mode
|
||||
event["stream_id"] = target_message.recipient.type_id
|
||||
|
||||
old_recipient_id = None
|
||||
if new_stream is not None:
|
||||
assert content is None
|
||||
assert target_message.is_stream_message()
|
||||
@@ -5799,7 +5798,6 @@ def do_update_message(
|
||||
|
||||
edit_history_event["prev_stream"] = stream_being_edited.id
|
||||
event[ORIG_TOPIC] = orig_topic_name
|
||||
old_recipient_id = target_message.recipient_id
|
||||
target_message.recipient_id = new_stream.recipient_id
|
||||
|
||||
event["new_stream_id"] = new_stream.id
|
||||
@@ -5864,6 +5862,8 @@ def do_update_message(
|
||||
delete_event_notify_user_ids: List[int] = []
|
||||
if propagate_mode in ["change_later", "change_all"]:
|
||||
assert topic_name is not None or new_stream is not None
|
||||
assert stream_being_edited is not None
|
||||
|
||||
# Other messages should only get topic/stream fields in their edit history.
|
||||
topic_only_edit_history_event = {
|
||||
k: v
|
||||
@@ -5883,7 +5883,7 @@ def do_update_message(
|
||||
orig_topic_name=orig_topic_name,
|
||||
topic_name=topic_name,
|
||||
new_stream=new_stream,
|
||||
old_recipient_id=old_recipient_id,
|
||||
old_stream=stream_being_edited,
|
||||
edit_history_event=topic_only_edit_history_event,
|
||||
last_edit_time=timestamp,
|
||||
)
|
||||
|
||||
@@ -145,18 +145,11 @@ def update_messages_for_topic_edit(
|
||||
orig_topic_name: str,
|
||||
topic_name: Optional[str],
|
||||
new_stream: Optional[Stream],
|
||||
old_recipient_id: Optional[int],
|
||||
old_stream: Stream,
|
||||
edit_history_event: Dict[str, Any],
|
||||
last_edit_time: datetime,
|
||||
) -> List[Message]:
|
||||
assert (new_stream and old_recipient_id) or (not new_stream and not old_recipient_id)
|
||||
|
||||
if old_recipient_id is not None:
|
||||
recipient_id = old_recipient_id
|
||||
else:
|
||||
recipient_id = edited_message.recipient_id
|
||||
|
||||
propagate_query = Q(recipient_id=recipient_id, subject__iexact=orig_topic_name)
|
||||
propagate_query = Q(recipient_id=old_stream.recipient_id, subject__iexact=orig_topic_name)
|
||||
if propagate_mode == "change_all":
|
||||
propagate_query = propagate_query & ~Q(id=edited_message.id)
|
||||
if propagate_mode == "change_later":
|
||||
|
||||
Reference in New Issue
Block a user