Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

topics: Refactor method that decides topic visibility after merge.

Rohan Gudimetla8330e7c283b1
diff --git a/zerver/actions/message_edit.py b/zerver/actions/message_edit.py
index 52d067399bf..b22a49bcb2f 100644
--- a/zerver/actions/message_edit.py
+++ b/zerver/actions/message_edit.py
@@ -486,14 +486,15 @@ def get_visibility_policy_after_merge(
# Whichever of the two policies is most visible is what we keep.
# The general motivation is to err on the side of showing messages
# rather than hiding them.
- if orig_topic_visibility_policy == target_topic_visibility_policy:
- return orig_topic_visibility_policy
- elif UserTopic.VisibilityPolicy.UNMUTED in (
- orig_topic_visibility_policy,
- target_topic_visibility_policy,
- ):
+ visibility_policies = {orig_topic_visibility_policy, target_topic_visibility_policy}
+
+ if UserTopic.VisibilityPolicy.UNMUTED in visibility_policies:
return UserTopic.VisibilityPolicy.UNMUTED
- return UserTopic.VisibilityPolicy.INHERIT
+
+ if UserTopic.VisibilityPolicy.INHERIT in visibility_policies:
+ return UserTopic.VisibilityPolicy.INHERIT
+
+ return UserTopic.VisibilityPolicy.MUTED
def update_message_content(