UserTopic: Set visibility_policy or delete UserTopic row without error.

This commit updates 'set_user_topic_visibility_policy_in_database'
to not raise an error when deleting a UserTopic row and the user
doesn't have a visibility_policy for the topic yet, or when setting
the visibility_policy to its current value.

Also, it includes the changes to not send unnecessary events
in such cases.
This commit is contained in:
Prakhar Pratyush
2023-03-14 19:39:12 +05:30
committed by Tim Abbott
parent f783e8b6ca
commit 042bbf2936
7 changed files with 88 additions and 78 deletions

View File

@@ -809,7 +809,6 @@ def do_update_message(
new_stream if new_stream is not None else stream_being_edited,
topic_name if topic_name is not None else orig_topic_name,
visibility_policy=UserTopic.VisibilityPolicy.MUTED,
ignore_duplicate=True,
)
send_event(user_profile.realm, event, users_to_be_notified)