mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 10:26:28 +00:00
home: Don't use pointer to compute furthest_read_time.
When a user is reading messages only in stream or topic narrows, the pointer can be left far behind. Using this to compute the furthest_read_time causes the banckruptcy banner to be shown even when a user has been actively reading messages. This commit switches to using the sent time on the last message that the user has read to compute the furthest read time.
This commit is contained in:
committed by
Tim Abbott
parent
d8def0de55
commit
8f32db81a1
@@ -13,7 +13,7 @@ from zerver.forms import ToSForm
|
||||
from zerver.models import Message, Stream, UserProfile, \
|
||||
Realm, UserMessage, \
|
||||
PreregistrationUser, \
|
||||
get_usermessage_by_message_id
|
||||
get_latest_read_usermessage
|
||||
from zerver.lib.events import do_events_register
|
||||
from zerver.lib.actions import do_change_tos_version, \
|
||||
realm_user_count
|
||||
@@ -223,10 +223,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
|
||||
register_ret['pointer'] = register_ret['max_message_id']
|
||||
furthest_read_time = None
|
||||
else:
|
||||
latest_read = get_usermessage_by_message_id(user_profile, user_profile.pointer)
|
||||
if latest_read is None:
|
||||
# Don't completely fail if your saved pointer ID is invalid
|
||||
logging.warning("User %s has invalid pointer %s" % (user_profile.id, user_profile.pointer))
|
||||
latest_read = get_latest_read_usermessage(user_profile)
|
||||
furthest_read_time = sent_time_in_epoch_seconds(latest_read)
|
||||
|
||||
# We pick a language for the user as follows:
|
||||
|
||||
Reference in New Issue
Block a user