mirror of https://github.com/zulip/zulip.git
recent_conversations: Only load filters during page load.
Instead of using localstorage to set the filters every time we render recent topics, we only do it during initial page load and then use the locally present `filters` variable to set the filters. This avoids multiple Zulip tabs of having a live impact on the filters used in recent conversations.
This commit is contained in:
parent
906ff9243a
commit
a9befc207b
|
@ -104,15 +104,6 @@ export function save_filters() {
|
||||||
ls.set(ls_key, Array.from(filters));
|
ls.set(ls_key, Array.from(filters));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function load_filters() {
|
|
||||||
if (!page_params.is_spectator) {
|
|
||||||
// A user may have a stored filter and can log out
|
|
||||||
// to see web public view. This ensures no filters are
|
|
||||||
// selected for spectators.
|
|
||||||
filters = new Set(ls.get(ls_key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function set_default_focus() {
|
export function set_default_focus() {
|
||||||
// If at any point we are confused about the currently
|
// If at any point we are confused about the currently
|
||||||
// focused element, we switch focus to search.
|
// focused element, we switch focus to search.
|
||||||
|
@ -792,8 +783,6 @@ export function complete_rerender() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update header
|
|
||||||
load_filters();
|
|
||||||
show_selected_filters();
|
show_selected_filters();
|
||||||
|
|
||||||
// Show topics list
|
// Show topics list
|
||||||
|
@ -1225,3 +1214,13 @@ export function change_focused_element($elt, input_key) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function initialize() {
|
||||||
|
// load filters from local storage.
|
||||||
|
if (!page_params.is_spectator) {
|
||||||
|
// A user may have a stored filter and can log out
|
||||||
|
// to see web public view. This ensures no filters are
|
||||||
|
// selected for spectators.
|
||||||
|
filters = new Set(ls.get(ls_key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ import * as presence from "./presence";
|
||||||
import * as realm_logo from "./realm_logo";
|
import * as realm_logo from "./realm_logo";
|
||||||
import * as realm_playground from "./realm_playground";
|
import * as realm_playground from "./realm_playground";
|
||||||
import * as realm_user_settings_defaults from "./realm_user_settings_defaults";
|
import * as realm_user_settings_defaults from "./realm_user_settings_defaults";
|
||||||
|
import * as recent_topics_ui from "./recent_topics_ui";
|
||||||
import * as recent_topics_util from "./recent_topics_util";
|
import * as recent_topics_util from "./recent_topics_util";
|
||||||
import * as reload from "./reload";
|
import * as reload from "./reload";
|
||||||
import * as rendered_markdown from "./rendered_markdown";
|
import * as rendered_markdown from "./rendered_markdown";
|
||||||
|
@ -613,6 +614,7 @@ export function initialize_everything() {
|
||||||
|
|
||||||
realm_logo.initialize();
|
realm_logo.initialize();
|
||||||
message_lists.initialize();
|
message_lists.initialize();
|
||||||
|
recent_topics_ui.initialize();
|
||||||
alert_words.initialize(alert_words_params);
|
alert_words.initialize(alert_words_params);
|
||||||
emojisets.initialize();
|
emojisets.initialize();
|
||||||
scroll_bar.initialize();
|
scroll_bar.initialize();
|
||||||
|
|
Loading…
Reference in New Issue