mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
activity: Don't read new messages without user activity.
We have a bug where we can mark messages as read as a result of a desktop left open with the Zulip window focused. To avoid it, we only mark new messages as read if there is some user activity. Note that we scroll to bring new messages into view which can mark them as read.
This commit is contained in:
@@ -634,6 +634,16 @@ export function initialize_everything(state_data) {
|
||||
|
||||
initialize_unread_ui();
|
||||
activity.initialize();
|
||||
activity.register_on_new_user_input_hook(() => {
|
||||
// Instead of marking new messages as read immediately when bottom
|
||||
// of feed is visible, we wait for user input to mark them as read.
|
||||
// This is to prevent marking messages as read unintentionally,
|
||||
// especially when user is away from screen and the window is focused.
|
||||
if (activity.received_new_messages && activity.new_user_input) {
|
||||
unread_ops.process_visible();
|
||||
activity.set_received_new_messages(false);
|
||||
}
|
||||
});
|
||||
activity_ui.initialize({
|
||||
narrow_by_email(email) {
|
||||
message_view.show(
|
||||
|
||||
Reference in New Issue
Block a user