mirror of https://github.com/zulip/zulip.git
search: Advertise the ability to search shared history.
When a user performs a search that might contain historical public streams messages that the user has access to (but doesn't because we're searching the user's own personal history), we add a notice above the first search result to let the user know that not all messages may have been searched. Fixes #12036.
This commit is contained in:
parent
d6c9de6036
commit
01b19291e7
|
@ -71,6 +71,7 @@ run_test('basics', () => {
|
|||
assert(filter.can_mark_messages_read());
|
||||
assert(!filter.contains_only_private_messages());
|
||||
assert(filter.allow_use_first_unread_when_narrowing());
|
||||
assert(filter.includes_full_stream_history());
|
||||
assert(filter.can_apply_locally());
|
||||
|
||||
operators = [
|
||||
|
@ -115,6 +116,7 @@ run_test('basics', () => {
|
|||
filter = new Filter(operators);
|
||||
assert(filter.has_operator('has'));
|
||||
assert(!filter.can_apply_locally());
|
||||
assert(!filter.includes_full_stream_history());
|
||||
|
||||
operators = [
|
||||
{operator: 'streams', operand: 'public', negated: true},
|
||||
|
@ -133,6 +135,7 @@ run_test('basics', () => {
|
|||
assert(filter.has_operator('streams'));
|
||||
assert(!filter.has_negated_operand('streams', 'public'));
|
||||
assert(!filter.can_apply_locally());
|
||||
assert(filter.includes_full_stream_history());
|
||||
|
||||
operators = [
|
||||
{operator: 'is', operand: 'private'},
|
||||
|
|
|
@ -394,6 +394,10 @@ Filter.prototype = {
|
|||
this.has_operator("pm-with") || this.has_operator("group-pm-with");
|
||||
},
|
||||
|
||||
includes_full_stream_history: function () {
|
||||
return this.has_operator("stream") || this.has_operator("streams");
|
||||
},
|
||||
|
||||
can_apply_locally: function () {
|
||||
if (this.is_search()) {
|
||||
// The semantics for matching keywords are implemented
|
||||
|
|
|
@ -281,6 +281,14 @@ exports.activate = function (raw_operators, opts) {
|
|||
compose.update_closed_compose_buttons_for_stream();
|
||||
}
|
||||
|
||||
// Toggle the notice that lets users know that not all messages were searched.
|
||||
if (!filter.contains_only_private_messages() &&
|
||||
!filter.includes_full_stream_history()) {
|
||||
$(".all-messages-search-caution").show();
|
||||
} else {
|
||||
$(".all-messages-search-caution").hide();
|
||||
}
|
||||
|
||||
// Put the narrow operators in the search bar.
|
||||
$('#search_query').val(Filter.unparse(operators));
|
||||
search.update_button_visibility();
|
||||
|
@ -690,6 +698,7 @@ function handle_post_narrow_deactivate_processes() {
|
|||
exports.narrow_title = "home";
|
||||
notifications.redraw_title();
|
||||
notifications.hide_or_show_history_limit_message(home_msg_list);
|
||||
$(".all-messages-search-caution").hide();
|
||||
}
|
||||
|
||||
exports.deactivate = function () {
|
||||
|
|
|
@ -531,7 +531,8 @@ on a dark background, and don't change the dark labels dark either. */
|
|||
stroke: hsl(0, 0%, 100%);
|
||||
}
|
||||
|
||||
.history-limited-box {
|
||||
.history-limited-box,
|
||||
.all-messages-search-caution {
|
||||
background-color: hsla(0, 0%, 0%, 0.2);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,8 +86,17 @@ p.n-margin {
|
|||
.history-limited-box {
|
||||
color: hsl(16, 60%, 45%);
|
||||
border: 1px solid hsl(16, 60%, 45%);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 0 2px hsl(16, 60%, 45%);
|
||||
}
|
||||
|
||||
.all-messages-search-caution {
|
||||
border: 1px solid hsla(192, 19%, 75%, 0.2);
|
||||
box-shadow: 0 0 2px hsla(192, 19%, 75%, 0.2);
|
||||
}
|
||||
|
||||
.history-limited-box,
|
||||
.all-messages-search-caution {
|
||||
border-radius: 4px;
|
||||
display: none;
|
||||
height: 28x;
|
||||
font-size: 16px;
|
||||
|
|
|
@ -18,6 +18,16 @@
|
|||
{% endtrans %}
|
||||
</p>
|
||||
</div>
|
||||
<div class="all-messages-search-caution" hidden>
|
||||
<p>
|
||||
<i class="fa fa-exclamation-circle" aria-hidden="true"></i>
|
||||
{% trans %}
|
||||
Additional results may be available if you add a <code>stream:</code>
|
||||
or <code>streams</code> operator to your search.
|
||||
<a href="/help/search-for-messages#messages-sent-before-you-joined" target="_blank">Learn more</a>.
|
||||
{% endtrans %}
|
||||
</p>
|
||||
</div>
|
||||
<div id="loading_more_messages_indicator"></div>
|
||||
<div id="page_loading_indicator"></div>
|
||||
<div id="first_run_message" class="empty_feed_notice">
|
||||
|
|
|
@ -68,10 +68,15 @@ keywords are ignored, we'll return 0 search results.
|
|||
|
||||
## Messages sent before you joined
|
||||
|
||||
In most cases, Zulip only searches messages that you received. In particular,
|
||||
this means Zulip will not search messages sent before you joined.
|
||||
Zulip's [stream permissions](/help/stream-permissions) model allows
|
||||
full access to the full history of public streams and [private streams
|
||||
with shared history](/help/stream-permissions), including messages
|
||||
sent before you joined the stream (or organization) or those sent to
|
||||
public streams you are not subscribed to.
|
||||
|
||||
However, if a) the search includes a `stream:` operator and b) that stream
|
||||
is either public or [private with shared history](/help/stream-permissions),
|
||||
Zulip will search the entire history of the stream, including messages
|
||||
that were sent before you joined.
|
||||
By default, Zulip searches messages in your personal history,
|
||||
i.e. the messages you actually received.
|
||||
|
||||
If you'd like to search the organization's shared history, any query
|
||||
using the `stream:` or `streams:` operators will search all messages
|
||||
that you have access to in the selected stream(s).
|
||||
|
|
Loading…
Reference in New Issue