mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 16:14:02 +00:00
empty-feed: Show special banner if muted topics in channel.
If we're in the feed for a channel and it is visibly empty because all of the messages are in topics that have been muted by the user, we now show an empty narrow banner that informs the user about why the feed is empty, how to view muted topics and links to the help center article on muting and unmuting topics. If the channel feed is empty and there are no messages in muted topics, then we show the default empty narrow banner. Fixes #31601. Co-authored-by: Lauryn Menard <lauryn@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
f2b33fc3ee
commit
2e59bb0768
@@ -5,6 +5,7 @@ import assert from "minimalistic-assert";
|
||||
import * as compose_validate from "./compose_validate.ts";
|
||||
import type {Filter} from "./filter.ts";
|
||||
import {$t, $t_html} from "./i18n.ts";
|
||||
import * as message_lists from "./message_lists.ts";
|
||||
import type {NarrowBannerData, SearchData} from "./narrow_error.ts";
|
||||
import {narrow_error} from "./narrow_error.ts";
|
||||
import {page_params} from "./page_params.ts";
|
||||
@@ -62,6 +63,22 @@ const STARRED_MESSAGES_VIEW_EMPTY_BANNER = {
|
||||
),
|
||||
};
|
||||
|
||||
const MUTED_TOPICS_IN_CHANNEL_EMPTY_BANNER = {
|
||||
title: $t({
|
||||
defaultMessage: "You have muted all the topics in this channel.",
|
||||
}),
|
||||
html: $t_html(
|
||||
{
|
||||
defaultMessage:
|
||||
"To view a muted topic, click <b>show all topics</b> in the left sidebar, and select one from the list. <z-link>Learn more</z-link>",
|
||||
},
|
||||
{
|
||||
"z-link": (content_html) =>
|
||||
`<a target="_blank" rel="noopener noreferrer" href="/help/mute-a-topic">${content_html.join("")}</a>`,
|
||||
},
|
||||
),
|
||||
};
|
||||
|
||||
function retrieve_search_query_data(current_filter: Filter): SearchData {
|
||||
// when search bar contains multiple filters, only retrieve search queries
|
||||
const search_query = current_filter.operands("search")[0];
|
||||
@@ -316,6 +333,12 @@ export function pick_empty_narrow_banner(current_filter: Filter): NarrowBannerDa
|
||||
}),
|
||||
};
|
||||
}
|
||||
assert(message_lists.current !== undefined);
|
||||
if (message_lists.current.visibly_empty() && !message_lists.current.empty()) {
|
||||
// The current message list appears empty, but there are
|
||||
// messages in muted topics.
|
||||
return MUTED_TOPICS_IN_CHANNEL_EMPTY_BANNER;
|
||||
}
|
||||
// else fallthrough to default case
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user