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.

scheduled_message_feed_ui: Show the scheduled indicator in near view.

Prakhar Pratyushbb4d62ffa685
diff --git a/web/src/filter.ts b/web/src/filter.ts
index 8a3d8dfbcd8..290683cdf2a 100644
--- a/web/src/filter.ts
+++ b/web/src/filter.ts
@@ -1303,6 +1303,17 @@ export class Filter {
return false;
}
+ is_conversation_view_with_near(): boolean {
+ const term_type = this.sorted_term_types();
+ if (
+ _.isEqual(term_type, ["channel", "topic", "near"]) ||
+ _.isEqual(term_type, ["dm", "near"])
+ ) {
+ return true;
+ }
+ return false;
+ }
+
excludes_muted_topics(): boolean {
return (
// not narrowed to a topic
diff --git a/web/src/scheduled_messages_feed_ui.ts b/web/src/scheduled_messages_feed_ui.ts
index af8864f935c..a4acbb742d2 100644
--- a/web/src/scheduled_messages_feed_ui.ts
+++ b/web/src/scheduled_messages_feed_ui.ts
@@ -10,7 +10,10 @@ import * as util from "./util";
function get_scheduled_messages_matching_narrow(): ScheduledMessage[] {
const scheduled_messages_list = [...scheduled_messages.scheduled_messages_data.values()];
const filter = narrow_state.filter();
- const is_conversation_view = filter === undefined ? false : filter.is_conversation_view();
+ const is_conversation_view =
+ filter === undefined
+ ? false
+ : filter.is_conversation_view() || filter.is_conversation_view_with_near();
const current_view_type = narrow_state.narrowed_to_pms() ? "private" : "stream";
if (!is_conversation_view) {
diff --git a/web/tests/filter.test.js b/web/tests/filter.test.js
index d0e2bb9510f..c0820e03841 100644
--- a/web/tests/filter.test.js
+++ b/web/tests/filter.test.js
@@ -181,6 +181,7 @@ test("basics", () => {
assert.ok(filter.can_bucket_by("channel"));
assert.ok(filter.can_bucket_by("channel", "topic"));
assert.ok(!filter.is_conversation_view());
+ assert.ok(filter.is_conversation_view_with_near());
// If our only channel operator is negated, then for all intents and purposes,
// we don't consider ourselves to have a channel operator, because we don't
@@ -295,6 +296,22 @@ test("basics", () => {
assert.ok(filter.can_apply_locally());
assert.ok(!filter.is_personal_filter());
assert.ok(filter.is_conversation_view());
+ assert.ok(!filter.is_conversation_view_with_near());
+
+ terms = [
+ {operator: "dm", operand: "[email protected]"},
+ {operator: "near", operand: 17},
+ ];
+ filter = new Filter(terms);
+ assert.ok(filter.is_non_huddle_pm());
+ assert.ok(filter.contains_only_private_messages());
+ 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());
+ assert.ok(!filter.is_personal_filter());
+ assert.ok(!filter.is_conversation_view());
+ assert.ok(filter.is_conversation_view_with_near());
terms = [{operator: "dm", operand: "[email protected],[email protected]"}];
filter = new Filter(terms);
@@ -305,6 +322,7 @@ test("basics", () => {
assert.ok(filter.can_apply_locally());
assert.ok(!filter.is_personal_filter());
assert.ok(filter.is_conversation_view());
+ assert.ok(!filter.is_conversation_view_with_near());
// "pm-with" was renamed to "dm"
terms = [{operator: "pm-with", operand: "[email protected]"}];
@@ -376,6 +394,7 @@ test("basics", () => {
assert.ok(filter.can_apply_locally());
assert.ok(!filter.is_personal_filter());
assert.ok(filter.is_conversation_view());
+ assert.ok(!filter.is_conversation_view_with_near());
// "stream" was renamed to "channel"
terms = [
@@ -393,6 +412,7 @@ test("basics", () => {
assert.ok(filter.can_apply_locally());
assert.ok(!filter.is_personal_filter());
assert.ok(filter.is_conversation_view());
+ assert.ok(!filter.is_conversation_view_with_near());
});
function assert_not_mark_read_with_has_operands(additional_terms_to_test) {