message_lists: Avoid setting message_lists.current in recent topics.

The original change in 5f127c85f7 was
intended to make the loop in message_lists.js not include a
potentially stale message_lists.current in the event that one is
viewing recent topics.

We revert that change and instead do the simpler thing of explicitly
checking whether we're viewing recent topics.

I was not able to prove this code was responsible for incidents this
week where all messages were marked as read while working in "Recent
topics", but is suspicious.

Likely the correct thing is to set message_lists.current to undefined
in this code path; I'm pretty sure it's an orphaned message list that
is no longer visible when viewing topics.
This commit is contained in:
Tim Abbott
2022-08-24 15:23:48 -07:00
parent 104fd6566a
commit 50f6d7ff73
2 changed files with 2 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
import {Filter} from "./filter";
import * as message_list from "./message_list";
import * as recent_topics_util from "./recent_topics_util";
export let home;
export let current;
@@ -10,7 +11,7 @@ export function set_current(msg_list) {
export function all_rendered_message_lists() {
const rendered_message_lists = [home];
if (current !== home) {
if (current !== home && !recent_topics_util.is_visible()) {
rendered_message_lists.push(current);
}
return rendered_message_lists;

View File

@@ -11,7 +11,6 @@ import {$t} from "./i18n";
import * as ListWidget from "./list_widget";
import * as loading from "./loading";
import {localstorage} from "./localstorage";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import * as message_util from "./message_util";
import * as message_view_header from "./message_view_header";
@@ -664,7 +663,6 @@ export function show() {
compose_closed_ui.update_buttons_for_recent_topics();
narrow_state.reset_current_filter();
message_lists.set_current(message_lists.home);
narrow.set_narrow_title("Recent topics");
message_view_header.render_title_area();
narrow.handle_middle_pane_transition();