mirror of https://github.com/zulip/zulip.git
message_edit: Clarify unmodified_user_messages logic.
This commit is contained in:
parent
13b9c87f93
commit
fc679b09a3
|
@ -597,7 +597,7 @@ def do_update_message(
|
||||||
]
|
]
|
||||||
losing_access_user_ids = [sub.user_profile_id for sub in subs_losing_access]
|
losing_access_user_ids = [sub.user_profile_id for sub in subs_losing_access]
|
||||||
|
|
||||||
ums = ums.exclude(
|
unmodified_user_messages = ums.exclude(
|
||||||
user_profile_id__in=[sub.user_profile_id for sub in subs_losing_usermessages]
|
user_profile_id__in=[sub.user_profile_id for sub in subs_losing_usermessages]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -610,6 +610,10 @@ def do_update_message(
|
||||||
gaining_usermessage_user_ids += [
|
gaining_usermessage_user_ids += [
|
||||||
user_id for user_id in new_stream_user_ids if user_id not in old_stream_user_ids
|
user_id for user_id in new_stream_user_ids if user_id not in old_stream_user_ids
|
||||||
]
|
]
|
||||||
|
else:
|
||||||
|
# If we're not moving the topic to another stream, we don't
|
||||||
|
# modify the original set of UserMessage objects queried.
|
||||||
|
unmodified_user_messages = ums
|
||||||
|
|
||||||
# We save the full topic name so that checks that require comparison
|
# We save the full topic name so that checks that require comparison
|
||||||
# between the original topic and the topic name passed into this function
|
# between the original topic and the topic name passed into this function
|
||||||
|
@ -760,7 +764,7 @@ def do_update_message(
|
||||||
# in the organization (too expansive, and also not what we do for
|
# in the organization (too expansive, and also not what we do for
|
||||||
# newly sent messages anyway) and having magical live-updates
|
# newly sent messages anyway) and having magical live-updates
|
||||||
# where possible.
|
# where possible.
|
||||||
users_to_be_notified = list(map(user_info, ums))
|
users_to_be_notified = list(map(user_info, unmodified_user_messages))
|
||||||
if stream_being_edited is not None and stream_being_edited.is_history_public_to_subscribers():
|
if stream_being_edited is not None and stream_being_edited.is_history_public_to_subscribers():
|
||||||
subscriptions = get_active_subscriptions_for_stream_id(
|
subscriptions = get_active_subscriptions_for_stream_id(
|
||||||
stream_id, include_deactivated_users=False
|
stream_id, include_deactivated_users=False
|
||||||
|
@ -773,7 +777,7 @@ def do_update_message(
|
||||||
# user both has a UserMessage row and is a current
|
# user both has a UserMessage row and is a current
|
||||||
# Subscriber
|
# Subscriber
|
||||||
subscriptions = subscriptions.exclude(
|
subscriptions = subscriptions.exclude(
|
||||||
user_profile_id__in=[um.user_profile_id for um in ums]
|
user_profile_id__in=[um.user_profile_id for um in unmodified_user_messages]
|
||||||
)
|
)
|
||||||
|
|
||||||
if new_stream is not None:
|
if new_stream is not None:
|
||||||
|
|
Loading…
Reference in New Issue