Revert "narrow: Do not mark messages as read in mentioned narrow."

This reverts commit 5e97ec9ad9.

This change has been pretty confusing for users, and so we need to do
something more in order to make the UI acceptable to change this
default.
This commit is contained in:
Tim Abbott
2021-07-29 17:31:03 -07:00
parent 3ce7a9dd08
commit 399dc5046b
2 changed files with 11 additions and 8 deletions

View File

@@ -170,7 +170,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.has_operator("search"));
assert.ok(filter.can_apply_locally());
assert.ok(filter.is_personal_filter());
@@ -250,7 +250,11 @@ 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.concat(is_operator));
if (additional_operators_to_test.length === 0) {
assert.ok(filter.can_mark_messages_read());
} else {
assert.ok(!filter.can_mark_messages_read());
}
is_operator = [{operator: "is", operand: "mentioned", negated: true}];
filter = new Filter(additional_operators_to_test.concat(is_operator));

View File

@@ -453,6 +453,10 @@ export class Filter {
return true;
}
if (_.isEqual(term_types, ["is-mentioned"])) {
return true;
}
if (_.isEqual(term_types, ["is-resolved"])) {
return true;
}
@@ -490,20 +494,15 @@ export class Filter {
// can_mark_messages_read tests the following filters:
// stream, stream + topic,
// is: private, pm-with:,
// is: resolved
// is: mentioned, 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)
// is: mentioned
// We don't mark messages as read when in mentioned narrow.
const term_types = this.sorted_term_types();
if (_.isEqual(term_types, ["is-mentioned"])) {
return true;
}
if (_.isEqual(term_types, ["is-starred"])) {
return true;
}