mirror of https://github.com/zulip/zulip.git
submessage: Fix recipients of "submessage" event.
Earlier, submessage was not live-updated for users who joined the stream after the message was sent. This commit fixes that bug. Also, now we use 'event_recipient_ids_for_action_on_messages'. It helps to add hardening such that if the invariant "no usermessage row corresponding to a message exists if the user loses access to the message" is violated due to some bug, it has minimal user impact.
This commit is contained in:
parent
d6c48b7185
commit
c3f2615e20
|
@ -3,12 +3,13 @@ from django.utils.translation import gettext as _
|
|||
from zerver.actions.user_topics import do_set_user_topic_visibility_policy
|
||||
from zerver.lib.exceptions import JsonableError
|
||||
from zerver.lib.message import (
|
||||
event_recipient_ids_for_action_on_messages,
|
||||
set_visibility_policy_possible,
|
||||
should_change_visibility_policy,
|
||||
visibility_policy_for_participation,
|
||||
)
|
||||
from zerver.lib.streams import access_stream_by_id
|
||||
from zerver.models import Realm, SubMessage, UserMessage, UserProfile
|
||||
from zerver.models import Realm, SubMessage, UserProfile
|
||||
from zerver.tornado.django_api import send_event_on_commit
|
||||
|
||||
|
||||
|
@ -90,7 +91,6 @@ def do_add_submessage(
|
|||
sender_id=sender_id,
|
||||
content=content,
|
||||
)
|
||||
ums = UserMessage.objects.filter(message_id=message_id)
|
||||
target_user_ids = [um.user_profile_id for um in ums]
|
||||
target_user_ids = event_recipient_ids_for_action_on_messages([submessage.message])
|
||||
|
||||
send_event_on_commit(realm, event, target_user_ids)
|
||||
|
|
Loading…
Reference in New Issue