mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
alert_words: Move alert_words from UserProfile to separate model.
Previously, alert words were a JSON list of strings stored in a TextField on user_profile. That hacky model reflected the fact that they were an early prototype feature. This commit migrates from that to a separate table, 'AlertWord'. The new AlertWord has user_profile, word, id and realm(denormalization so we can provide a nice index for fetching all the alert words in a realm). This transition requires moving the logic for flushing the Alert Words caches to their own independent feature. Note that this commit should not be cherry-picked without the following commit, which fixes case-sensitivity issues with Alert Words.
This commit is contained in:
committed by
Tim Abbott
parent
818776faae
commit
052368bd3e
@@ -540,12 +540,6 @@ def flush_user_profile(sender: Any, **kwargs: Any) -> None:
|
||||
if user_profile.is_bot and changed(kwargs, bot_dict_fields):
|
||||
cache_delete(bot_dicts_in_realm_cache_key(user_profile.realm))
|
||||
|
||||
# Invalidate realm-wide alert words cache if any user in the realm has changed
|
||||
# alert words
|
||||
if changed(kwargs, ['alert_words']):
|
||||
cache_delete(realm_alert_words_cache_key(user_profile.realm))
|
||||
cache_delete(realm_alert_words_automaton_cache_key(user_profile.realm))
|
||||
|
||||
# Called by models.py to flush various caches whenever we save
|
||||
# a Realm object. The main tricky thing here is that Realm info is
|
||||
# generally cached indirectly through user_profile objects.
|
||||
|
||||
Reference in New Issue
Block a user