Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
search: Improve text about searching public channels.
Kislay Vermade430f541cd0
diff --git a/web/src/info_overlay.ts b/web/src/info_overlay.tsindex b257c386752..163b70b028f 100644--- a/web/src/info_overlay.ts+++ b/web/src/info_overlay.ts@@ -12,8 +12,10 @@ import {$t, $t_html} from "./i18n";import * as keydown_util from "./keydown_util";import * as markdown from "./markdown";import * as overlays from "./overlays";+import {page_params} from "./page_params";import * as rendered_markdown from "./rendered_markdown";import * as scroll_util from "./scroll_util";+import {current_user} from "./state_data";import {user_settings} from "./user_settings";import * as util from "./util";@@ -277,7 +279,11 @@ export function set_up_toggler(): void {});$(".informational-overlays .overlay-body").append($markdown_help);- const $search_operators = $(render_search_operator());+ const $search_operators = $(+ render_search_operator({+ can_access_all_public_channels: !page_params.is_spectator && !current_user.is_guest,+ }),+ );$(".informational-overlays .overlay-body").append($search_operators);const $keyboard_shortcuts = $(render_keyboard_shortcut());diff --git a/web/src/search_suggestion.ts b/web/src/search_suggestion.tsindex 118df6e8cf0..978d00d1e5a 100644--- a/web/src/search_suggestion.ts+++ b/web/src/search_suggestion.ts@@ -11,7 +11,7 @@ import * as narrow_state from "./narrow_state";import {page_params} from "./page_params";import * as people from "./people";import type {User} from "./people";-import type {NarrowTerm} from "./state_data";+import {type NarrowTerm, current_user} from "./state_data";import * as stream_data from "./stream_data";import * as stream_topic_history from "./stream_topic_history";import * as stream_topic_history_util from "./stream_topic_history_util";@@ -625,10 +625,16 @@ function get_channels_filter_suggestions(last: NarrowTerm, terms: NarrowTerm[]):if (last.operator === "search" && common.phrase_match(last.operand, "streams")) {search_string = "streams:public";}+ let description_html;+ if (page_params.is_spectator || current_user.is_guest) {+ description_html = "All public channels that you can view";+ } else {+ description_html = "All public channels";+ }const suggestions: SuggestionAndIncompatiblePatterns[] = [{search_string,- description_html: "All public channels in organization",+ description_html,is_people: false,incompatible_patterns: [{operator: "is", operand: "dm"},diff --git a/web/src/ui_init.js b/web/src/ui_init.jsindex 8ba30d97894..cab35eb7939 100644--- a/web/src/ui_init.js+++ b/web/src/ui_init.js@@ -192,7 +192,11 @@ function initialize_compose_box() {}function initialize_message_feed_errors() {- $("#message_feed_errors_container").html(render_message_feed_errors());+ $("#message_feed_errors_container").html(+ render_message_feed_errors({+ is_guest: current_user.is_guest,+ }),+ );}export function initialize_kitchen_sink_stuff() {diff --git a/web/templates/message_feed_errors.hbs b/web/templates/message_feed_errors.hbsindex 04d041215e8..1bf15b410f7 100644--- a/web/templates/message_feed_errors.hbs+++ b/web/templates/message_feed_errors.hbs@@ -20,10 +20,17 @@{{/tr}} <span>- {{#tr}}- Consider <z-link>searching all public channels</z-link>.- {{#*inline "z-link"}}<a class="search-shared-history" href="">{{> @partial-block}}</a>{{/inline}}- {{/tr}}+ {{#if is_guest}}+ {{#tr}}+ Consider <z-link>searching all public channels that you can view</z-link>.+ {{#*inline "z-link"}}<a class="search-shared-history" href="">{{> @partial-block}}</a>{{/inline}}+ {{/tr}}+ {{else}}+ {{#tr}}+ Consider <z-link>searching all public channels</z-link>.+ {{#*inline "z-link"}}<a class="search-shared-history" href="">{{> @partial-block}}</a>{{/inline}}+ {{/tr}}+ {{/if}}</span></p></div>diff --git a/web/templates/search_operators.hbs b/web/templates/search_operators.hbsindex 26be8bbded3..5008366e023 100644--- a/web/templates/search_operators.hbs+++ b/web/templates/search_operators.hbs@@ -63,7 +63,11 @@<tr><td class="operator">channels:public</td><td class="definition">- {{t 'Search all public channels in the organization.'}}+ {{#if can_access_all_public_channels }}+ {{t 'Search all public channels.'}}+ {{else}}+ {{t 'Search all public channels that you can view.'}}+ {{/if}}</td></tr><tr>