mirror of
https://github.com/zulip/zulip.git
synced 2025-10-27 10:03:56 +00:00
combined-feed-ui: Add placeholder text to empty combined feed.
Also, added live update behaviour to the combined feed narrow. Fixes #31602.
This commit is contained in:
committed by
Tim Abbott
parent
99f3de5855
commit
28cbc498d7
@@ -579,19 +579,17 @@ export class MessageList {
|
||||
this.view.clear_rendering_state(false);
|
||||
this.view.update_render_window(this.selected_idx(), false);
|
||||
|
||||
if (!this.is_combined_feed_view) {
|
||||
if (
|
||||
this.visibly_empty() &&
|
||||
this.data.fetch_status.has_found_oldest() &&
|
||||
this.data.fetch_status.has_found_newest()
|
||||
) {
|
||||
// Show the empty narrow message only if we're certain
|
||||
// that the view doesn't have messages that we're
|
||||
// waiting for the server to send us.
|
||||
narrow_banner.show_empty_narrow_message();
|
||||
} else {
|
||||
narrow_banner.hide_empty_narrow_message();
|
||||
}
|
||||
if (
|
||||
this.visibly_empty() &&
|
||||
this.data.fetch_status.has_found_oldest() &&
|
||||
this.data.fetch_status.has_found_newest()
|
||||
) {
|
||||
// Show the empty narrow message only if we're certain
|
||||
// that the view doesn't have messages that we're
|
||||
// waiting for the server to send us.
|
||||
narrow_banner.show_empty_narrow_message();
|
||||
} else {
|
||||
narrow_banner.hide_empty_narrow_message();
|
||||
}
|
||||
this.rerender_view();
|
||||
}
|
||||
|
||||
@@ -128,10 +128,28 @@ export function pick_empty_narrow_banner(): NarrowBannerData {
|
||||
const default_banner_for_multiple_filters = $t({defaultMessage: "No search results."});
|
||||
|
||||
const current_filter = narrow_state.filter();
|
||||
|
||||
if (current_filter === undefined || current_filter.is_in_home()) {
|
||||
if (current_filter === undefined) {
|
||||
// We're in either the inbox or recent conversations view.
|
||||
return default_banner;
|
||||
}
|
||||
if (current_filter.is_in_home()) {
|
||||
// We're in the combined feed view.
|
||||
return {
|
||||
title: $t({defaultMessage: "There are no messages in your combined feed."}),
|
||||
html: page_params.is_spectator
|
||||
? ""
|
||||
: $t_html(
|
||||
{
|
||||
defaultMessage:
|
||||
"Would you like to <z-link>view messages in all public channels</z-link>?",
|
||||
},
|
||||
{
|
||||
"z-link": (content_html) =>
|
||||
`<a href="#narrow/channels/public">${content_html.join("")}</a>`,
|
||||
},
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
const first_term = current_filter.terms()[0]!;
|
||||
const current_terms_types = current_filter.sorted_term_types();
|
||||
|
||||
@@ -248,6 +248,18 @@ run_test("show_empty_narrow_message", ({mock_template, override}) => {
|
||||
),
|
||||
);
|
||||
|
||||
// for empty combined feed
|
||||
const current_filter = new Filter([{operator: "in", operand: "home"}]);
|
||||
message_lists.set_current({data: {filter: current_filter}});
|
||||
narrow_banner.show_empty_narrow_message();
|
||||
assert.equal(
|
||||
$(".empty_feed_notice_main").html(),
|
||||
empty_narrow_html(
|
||||
"translated: There are no messages in your combined feed.",
|
||||
'translated HTML: Would you like to <a href="#narrow/channels/public">view messages in all public channels</a>?',
|
||||
),
|
||||
);
|
||||
|
||||
// for non-existent or private stream
|
||||
set_filter([["stream", "999"]]);
|
||||
narrow_banner.show_empty_narrow_message();
|
||||
|
||||
Reference in New Issue
Block a user