Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

all_messages_data: Fix muted user messages not included in data.

Aman Agrawal6cb71526e839
diff --git a/web/src/all_messages_data.ts b/web/src/all_messages_data.ts
index e21164c7e6b..662317eb5c5 100644
--- a/web/src/all_messages_data.ts
+++ b/web/src/all_messages_data.ts
@@ -3,6 +3,7 @@ import {MessageListData} from "./message_list_data.ts";
export let all_messages_data = new MessageListData({
excludes_muted_topics: false,
+ excludes_muted_users: false,
filter: new Filter([]),
});
diff --git a/web/src/message_list_data.ts b/web/src/message_list_data.ts
index 78b8aefa6de..e5a7a0fa5ac 100644
--- a/web/src/message_list_data.ts
+++ b/web/src/message_list_data.ts
@@ -31,11 +31,11 @@ export class MessageListData {
// message ID. It's used to efficiently query if a given
// message is present.
_hash: Map<number, Message>;
- // Some views exclude muted topics.
+ // Some views exclude muted topics / users.
//
- // TODO: Refactor this to be a property of Filter, rather than
- // a parameter that needs to be passed into the constructor.
+ // Also, `all_messages_data` never excludes anything by definition.
excludes_muted_topics: boolean;
+ excludes_muted_users: boolean;
// Tracks any locally echoed messages, which we know aren't present on the server.
_local_only: Set<number>;
// The currently selected message ID. The special value -1
@@ -60,7 +60,15 @@ export class MessageListData {
// See also MessageList and MessageListView, which are important
// to actually display a message list.
- constructor({excludes_muted_topics, filter}: {excludes_muted_topics: boolean; filter: Filter}) {
+ constructor({
+ excludes_muted_topics,
+ excludes_muted_users = true,
+ filter,
+ }: {
+ excludes_muted_topics: boolean;
+ excludes_muted_users?: boolean;
+ filter: Filter;
+ }) {
this.filter = filter;
this.fetch_status = new FetchStatus();
this.participants = new ConversationParticipants([]);
@@ -68,6 +76,7 @@ export class MessageListData {
this._items = [];
this._hash = new Map();
this.excludes_muted_topics = excludes_muted_topics;
+ this.excludes_muted_users = excludes_muted_users;
this._local_only = new Set();
this._selected_id = -1;
}
@@ -240,7 +249,7 @@ export class MessageListData {
// Don't exclude messages sent by muted users if we're
// searching for a specific group or user, since the user
// presumably wants to see those messages.
- if (this.filter.is_search_for_specific_group_or_user()) {
+ if (!this.excludes_muted_users || this.filter.is_search_for_specific_group_or_user()) {
return [...messages];
}