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

This commit is contained in:
evykassirer 2023-07-20 17:32:29 -07:00 committed by Tim Abbott
parent 1cccdd8103
commit 834f759e8b
2 changed files with 9 additions and 13 deletions

View File

@ -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;
}

View File

@ -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]);