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.

combined_feed: Add top of feed notice to combined feed view.

Pratik Chanda34de62c5e555
diff --git a/web/src/filter.ts b/web/src/filter.ts
index 31a510ea5c4..eb8eb54fe11 100644
--- a/web/src/filter.ts
+++ b/web/src/filter.ts
@@ -1725,10 +1725,10 @@ export class Filter {
);
}
- may_have_incomplete_message_history(): boolean {
+ may_have_incomplete_message_history(treat_combined_feed_as_complete = true): boolean {
// Whether the filter may not include all messages.
return (
- !this.is_in_home() &&
+ (!treat_combined_feed_as_complete || !this.is_in_home()) &&
!this.contains_only_private_messages() &&
!this.includes_full_stream_history() &&
!this.is_personal_filter() &&
diff --git a/web/src/message_feed_top_notices.ts b/web/src/message_feed_top_notices.ts
index 36008ddcbf7..b6dc87b8e43 100644
--- a/web/src/message_feed_top_notices.ts
+++ b/web/src/message_feed_top_notices.ts
@@ -24,24 +24,30 @@ function hide_history_limit_notice(): void {
function hide_end_of_results_notice(): void {
$(".all-messages-search-caution").hide();
+ $(".combined-feed-notice").hide();
}
function show_end_of_results_notice(): void {
- // end-of-results notices are hidden for spectators, so leave the
+ // Both end-of-results notices are hidden for spectators, so leave the
// top-of-feed logo in place for them rather than hiding it and showing
// nothing.
if (page_params.is_spectator) {
return;
}
$(".top-messages-logo").hide();
- $(".all-messages-search-caution").show();
- // Set the link to point to this search with streams:public added.
- // Note that element we adjust is not visible to spectators.
const narrow_filter = narrow_state.filter();
assert(narrow_filter !== undefined);
+
+ if (narrow_filter.is_in_home()) {
+ $(".combined-feed-notice").show();
+ return;
+ }
const terms = narrow_filter.terms();
+ // Set the link to point to this search with streams:public added.
+ // Note that element we adjust is not visible to spectators.
const update_hash = hash_util.search_public_streams_notice_url(terms);
+ $(".all-messages-search-caution").show();
$(".all-messages-search-caution .search-shared-history").attr("data-url", update_hash);
}
@@ -60,7 +66,7 @@ export function update_top_of_narrow_notices(msg_list: MessageList): void {
// conditions, but there's a very legitimate use case
// for moderation of searching for all messages sent
// by a potential spammer user.
- if (filter?.may_have_incomplete_message_history()) {
+ if (filter?.may_have_incomplete_message_history(false)) {
show_end_of_results_notice();
}
}
diff --git a/web/styles/zulip.css b/web/styles/zulip.css
index 870b359c1fa..7521f487fde 100644
--- a/web/styles/zulip.css
+++ b/web/styles/zulip.css
@@ -195,10 +195,12 @@ p.n-margin {
margin: 0;
}
-.all-messages-search-caution {
+.all-messages-search-caution,
+.combined-feed-notice {
display: none;
- .all-messages-search-caution-info {
+ .all-messages-search-caution-info,
+ .combined-feed-notice-info {
display: flex;
flex-wrap: wrap;
align-items: center;
@@ -219,7 +221,8 @@ p.n-margin {
}
.history-limited-box,
-.all-messages-search-caution {
+.all-messages-search-caution,
+.combined-feed-notice {
margin: 0 auto 12px;
padding: 5px;
diff --git a/web/templates/message_feed_errors.hbs b/web/templates/message_feed_errors.hbs
index d7eff41759f..52efa30aa6d 100644
--- a/web/templates/message_feed_errors.hbs
+++ b/web/templates/message_feed_errors.hbs
@@ -37,4 +37,26 @@
</button>
</div>
</div>
+<div class="combined-feed-notice hidden-for-spectators">
+ <div class="combined-feed-notice-info">
+ <p>
+ {{#tr}}
+ End of messages in your
+ <z-link>combined feed</z-link>.
+ {{#*inline "z-link"}}<a href="/help/combined-feed"
+ target="_blank" rel="noopener noreferrer">{{> @partial-block}}</a>{{/inline}}
+ {{/tr}}
+ </p>
+ <button
+ class="search-shared-history action-button action-button-subtle-neutral"
+ type="button"
+ data-url="#narrow/channels/public">
+ {{#if is_guest}}
+ {{t 'View all messages in your public channels'}}
+ {{else}}
+ {{t 'View all messages in public channels'}}
+ {{/if}}
+ </button>
+ </div>
+</div>
<div class="empty_feed_notice_main"></div>