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.

message view: Don't mark message as read in mentions view.

evykassirer834f759e8b85
diff --git a/web/src/filter.js b/web/src/filter.js
index 7986b0bde70..aef49258c5f 100644
--- a/web/src/filter.js
+++ b/web/src/filter.js
@@ -527,10 +527,6 @@ export class Filter {
return true;
}
- if (_.isEqual(term_types, ["is-mentioned"])) {
- return true;
- }
-
if (_.isEqual(term_types, ["is-resolved"])) {
return true;
}
@@ -568,15 +564,19 @@ export class Filter {
// can_mark_messages_read tests the following filters:
// stream, stream + topic,
// is:dm, dm,
- // is:mentioned, is:resolved
+ // is:resolved
if (this.can_mark_messages_read()) {
return true;
}
// that leaves us with checking:
// is: starred
- // (which can_mark_messages_read_does not check as starred messages are always read)
+ // (which can_mark_messages_read does not check as starred messages are always read)
+ // is: mentioned
+ // (for which can_mark_messages_read returns false, since they don't have conversation context)
const term_types = this.sorted_term_types();
-
+ if (_.isEqual(term_types, ["is-mentioned"])) {
+ return true;
+ }
if (_.isEqual(term_types, ["is-starred"])) {
return true;
}
diff --git a/web/tests/filter.test.js b/web/tests/filter.test.js
index f83fc3b44f5..c3ae68c9a78 100644
--- a/web/tests/filter.test.js
+++ b/web/tests/filter.test.js
@@ -213,7 +213,7 @@ test("basics", () => {
operators = [{operator: "is", operand: "mentioned"}];
filter = new Filter(operators);
assert.ok(!filter.contains_only_private_messages());
- assert.ok(filter.can_mark_messages_read());
+ assert.ok(!filter.can_mark_messages_read());
assert.ok(!filter.supports_collapsing_recipients());
assert.ok(!filter.has_operator("search"));
assert.ok(filter.can_apply_locally());
@@ -361,11 +361,7 @@ function assert_not_mark_read_with_is_operands(additional_operators_to_test) {
is_operator = [{operator: "is", operand: "mentioned"}];
filter = new Filter([...additional_operators_to_test, ...is_operator]);
- if (additional_operators_to_test.length === 0) {
- assert.ok(filter.can_mark_messages_read());
- } else {
- assert.ok(!filter.can_mark_messages_read());
- }
+ assert.ok(!filter.can_mark_messages_read());
is_operator = [{operator: "is", operand: "mentioned", negated: true}];
filter = new Filter([...additional_operators_to_test, ...is_operator]);