mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
messages: Rename last_visible_message_id to first_visible_message_id.
This commit is contained in:
@@ -411,9 +411,9 @@ def flush_realm(sender: Any, **kwargs: Any) -> None:
|
||||
delete_user_profile_caches(users)
|
||||
|
||||
# Deleting realm or updating message_visibility_limit
|
||||
# attribute should clear the last_visible_message_id cache.
|
||||
# attribute should clear the first_visible_message_id cache.
|
||||
if kwargs.get('update_fields') is None or "message_visibility_limit" in kwargs['update_fields']:
|
||||
cache_delete(realm_last_visible_message_id_cache_key(realm))
|
||||
cache_delete(realm_first_visible_message_id_cache_key(realm))
|
||||
|
||||
if realm.deactivated:
|
||||
cache_delete(realm_user_dicts_cache_key(realm.id))
|
||||
@@ -425,9 +425,9 @@ def realm_alert_words_cache_key(realm):
|
||||
# type: (Realm) -> Text
|
||||
return u"realm_alert_words:%s" % (realm.string_id,)
|
||||
|
||||
def realm_last_visible_message_id_cache_key(realm):
|
||||
def realm_first_visible_message_id_cache_key(realm):
|
||||
# type: (Realm) -> Text
|
||||
return u"realm_last_visible_message_id:%s" % (realm.string_id,)
|
||||
return u"realm_first_visible_message_id:%s" % (realm.string_id,)
|
||||
|
||||
# Called by models.py to flush the stream cache whenever we save a stream
|
||||
# object.
|
||||
|
||||
@@ -13,7 +13,7 @@ from zerver.lib.cache import (
|
||||
generic_bulk_cached_fetch,
|
||||
to_dict_cache_key,
|
||||
to_dict_cache_key_id,
|
||||
realm_last_visible_message_id_cache_key,
|
||||
realm_first_visible_message_id_cache_key,
|
||||
)
|
||||
from zerver.lib.request import JsonableError
|
||||
from zerver.lib.stream_subscription import (
|
||||
@@ -852,7 +852,7 @@ def apply_unread_message_event(user_profile: UserProfile,
|
||||
# don't need to restrict messages to exactly
|
||||
# message_visibility_limit. The query is also reasonably fast
|
||||
# so cache misses can be managed without cron job.
|
||||
@cache_with_key(realm_last_visible_message_id_cache_key, timeout=3600*4)
|
||||
@cache_with_key(realm_first_visible_message_id_cache_key, timeout=3600*4)
|
||||
def get_first_visible_message_id(realm: Realm) -> int:
|
||||
if realm.message_visibility_limit is None:
|
||||
return 0
|
||||
|
||||
@@ -31,7 +31,6 @@ from zerver.lib.message import (
|
||||
messages_for_ids,
|
||||
sew_messages_and_reactions,
|
||||
get_first_visible_message_id,
|
||||
realm_last_visible_message_id_cache_key,
|
||||
)
|
||||
|
||||
from zerver.lib.test_helpers import (
|
||||
|
||||
Reference in New Issue
Block a user