mirror of https://github.com/zulip/zulip.git
f844cb6dad
In order to support different types of topic visibility policies, this renames 'add_topic_mute' to 'set_user_topic_visibility_policy_in_database' and refactors it to accept a parameter 'visibility_policy'. Create a corresponding UserTopic row for any visibility policy, not just muting topics. When a UserTopic row for (user_profile, stream, topic, recipient_id) exists already, it updates the row with the new visibility_policy. In the event of a duplicate request, raises a JsonableError. i.e., new_visibility_policy == existing_visibility_policy. There is an increase in the database query count in the message-edit code path. Reason: Earlier, 'add_topic_mute' used 'bulk_create' which either creates or raises IntegrityError -- 1 query. Now, 'set_user_topic_visibility_policy' uses get_or_create -- 2 queries in the case of creating new row. We can't use the previous approach, because now we have to handle the case of updating the visibility_policy too. Also, using bulk_* for a single row is not the correct way. Co-authored-by: Kartik Srivastava <kaushiksri0908@gmail.com> Co-authored-by: Prakhar Pratyush <prakhar841301@gmail.com> |
||
---|---|---|
.. | ||
actions | ||
data_import | ||
integration_fixtures/nagios | ||
lib | ||
management | ||
migrations | ||
openapi | ||
tests | ||
tornado | ||
views | ||
webhooks | ||
worker | ||
__init__.py | ||
apps.py | ||
context_processors.py | ||
decorator.py | ||
filters.py | ||
forms.py | ||
logging_handlers.py | ||
middleware.py | ||
models.py | ||
signals.py |