Skip to content

Commit

Permalink
message view: Do not mark selected message as read on narrow.
Browse files Browse the repository at this point in the history
For narrows where we select the first unread message
on activation, we also `force_rerender` the message
list which causes the message to get reselected.

Thus when the `MessageList.select_id` is called for
the first time, `previously_selected` is -1. However,
due to this rerender on selecting the message again
the previously selected message and our to be selected
message is the same.

On passing this information to the `message_selected.zulip`
event, the event handler in `message_scroll.js` tries to
mark the message as read. The message is marked on the
second event instead of the first as the previously
selected message is -1.

Fixes zulip#10886.
  • Loading branch information
ryanreh99 committed Sep 7, 2020
1 parent 7b62d31 commit 7c62ca5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion static/js/message_scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ exports.initialize = function () {

// Scroll handler that marks messages as read when you scroll past them.
$(document).on("message_selected.zulip", (event) => {
if (event.id === -1) {
if (event.id === -1 || event.id === event.previously_selected) {
return;
}

Expand Down

0 comments on commit 7c62ca5

Please sign in to comment.