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.

narrow-banner: Check user exists with "group-pm-with" empty narrow.

Lauryn Menardaf00fd05b203
diff --git a/frontend_tests/node_tests/narrow.js b/frontend_tests/node_tests/narrow.js
index 16f3a85ec9b..467e55aa497 100644
--- a/frontend_tests/node_tests/narrow.js
+++ b/frontend_tests/node_tests/narrow.js
@@ -386,6 +386,14 @@ run_test("show_empty_narrow_message", ({mock_template}) => {
),
);
+ set_filter([["group-pm-with", ["Yo"]]]);
+ hide_all_empty_narrow_messages();
+ narrow_banner.show_empty_narrow_message();
+ assert.equal(
+ $(".empty_feed_notice_main").html(),
+ empty_narrow_html("translated: This user does not exist!"),
+ );
+
set_filter([["sender", "[email protected]"]]);
hide_all_empty_narrow_messages();
narrow_banner.show_empty_narrow_message();
diff --git a/static/js/narrow_banner.js b/static/js/narrow_banner.js
index 2a083282cc5..d76e4b8a022 100644
--- a/static/js/narrow_banner.js
+++ b/static/js/narrow_banner.js
@@ -330,19 +330,24 @@ function pick_empty_narrow_banner() {
title: $t({defaultMessage: "This user does not exist!"}),
};
case "group-pm-with":
+ if (people.get_by_email(first_operand)) {
+ return {
+ title: $t({
+ defaultMessage: "You have no group private messages with this person yet!",
+ }),
+ html: $t_html(
+ {
+ defaultMessage: "Why not <z-link>start the conversation</z-link>?",
+ },
+ {
+ "z-link": (content_html) =>
+ `<a href="#" class="empty_feed_compose_private">${content_html}</a>`,
+ },
+ ),
+ };
+ }
return {
- title: $t({
- defaultMessage: "You have no group private messages with this person yet!",
- }),
- html: $t_html(
- {
- defaultMessage: "Why not <z-link>start the conversation</z-link>?",
- },
- {
- "z-link": (content_html) =>
- `<a href="#" class="empty_feed_compose_private">${content_html}</a>`,
- },
- ),
+ title: $t({defaultMessage: "This user does not exist!"}),
};
}
return default_banner;