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: Tighten `NarrowBannerData` type.

Pratik Chanda2f30a997b1eb
diff --git a/web/src/narrow_banner.ts b/web/src/narrow_banner.ts
index a325b491bc2..be7c3abc6ef 100644
--- a/web/src/narrow_banner.ts
+++ b/web/src/narrow_banner.ts
@@ -539,12 +539,6 @@ export function pick_empty_narrow_banner(current_filter: Filter): NarrowBannerDa
// mentions:me is redirected to is:mentioned in Filter.parse(),
// so mentioned_user will never be the current user here.
return {
- title: $t(
- {
- defaultMessage: "No messages in your message history mention {person} yet.",
- },
- {person: mentioned_user.full_name},
- ),
title_html: $t_html(
{
defaultMessage:
diff --git a/web/src/narrow_error.ts b/web/src/narrow_error.ts
index 9c4c409a89d..eba06a67aac 100644
--- a/web/src/narrow_error.ts
+++ b/web/src/narrow_error.ts
@@ -11,23 +11,13 @@ export type SearchData = {
};
export type NarrowBannerData = {
- title: string;
- title_html?: string;
html?: string;
search_data?: SearchData;
-};
+} & ({title: string} | {title_html: string});
export function narrow_error(narrow_banner_data: NarrowBannerData): string {
- const title = narrow_banner_data.title;
- const title_html = narrow_banner_data.title_html;
- const notice_html = narrow_banner_data.html;
- const search_data = narrow_banner_data.search_data;
-
- const empty_feed_notice = render_empty_feed_notice({
- title,
- title_html,
- notice_html,
- search_data,
+ return render_empty_feed_notice({
+ ...narrow_banner_data,
+ notice_html: narrow_banner_data.html,
});
- return empty_feed_notice;
}