mirror of
https://github.com/zulip/zulip.git
synced 2025-10-30 11:33:51 +00:00
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:
@@ -71,6 +71,7 @@ run_test('basics', () => {
|
|||||||
assert(filter.can_mark_messages_read());
|
assert(filter.can_mark_messages_read());
|
||||||
assert(!filter.contains_only_private_messages());
|
assert(!filter.contains_only_private_messages());
|
||||||
assert(filter.allow_use_first_unread_when_narrowing());
|
assert(filter.allow_use_first_unread_when_narrowing());
|
||||||
|
assert(filter.includes_full_stream_history());
|
||||||
assert(filter.can_apply_locally());
|
assert(filter.can_apply_locally());
|
||||||
|
|
||||||
operators = [
|
operators = [
|
||||||
@@ -115,6 +116,7 @@ run_test('basics', () => {
|
|||||||
filter = new Filter(operators);
|
filter = new Filter(operators);
|
||||||
assert(filter.has_operator('has'));
|
assert(filter.has_operator('has'));
|
||||||
assert(!filter.can_apply_locally());
|
assert(!filter.can_apply_locally());
|
||||||
|
assert(!filter.includes_full_stream_history());
|
||||||
|
|
||||||
operators = [
|
operators = [
|
||||||
{operator: 'streams', operand: 'public', negated: true},
|
{operator: 'streams', operand: 'public', negated: true},
|
||||||
@@ -133,6 +135,7 @@ run_test('basics', () => {
|
|||||||
assert(filter.has_operator('streams'));
|
assert(filter.has_operator('streams'));
|
||||||
assert(!filter.has_negated_operand('streams', 'public'));
|
assert(!filter.has_negated_operand('streams', 'public'));
|
||||||
assert(!filter.can_apply_locally());
|
assert(!filter.can_apply_locally());
|
||||||
|
assert(filter.includes_full_stream_history());
|
||||||
|
|
||||||
operators = [
|
operators = [
|
||||||
{operator: 'is', operand: 'private'},
|
{operator: 'is', operand: 'private'},
|
||||||
|
|||||||
@@ -394,6 +394,10 @@ Filter.prototype = {
|
|||||||
this.has_operator("pm-with") || this.has_operator("group-pm-with");
|
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 () {
|
can_apply_locally: function () {
|
||||||
if (this.is_search()) {
|
if (this.is_search()) {
|
||||||
// The semantics for matching keywords are implemented
|
// The semantics for matching keywords are implemented
|
||||||
|
|||||||
@@ -281,6 +281,14 @@ exports.activate = function (raw_operators, opts) {
|
|||||||
compose.update_closed_compose_buttons_for_stream();
|
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.
|
// Put the narrow operators in the search bar.
|
||||||
$('#search_query').val(Filter.unparse(operators));
|
$('#search_query').val(Filter.unparse(operators));
|
||||||
search.update_button_visibility();
|
search.update_button_visibility();
|
||||||
@@ -690,6 +698,7 @@ function handle_post_narrow_deactivate_processes() {
|
|||||||
exports.narrow_title = "home";
|
exports.narrow_title = "home";
|
||||||
notifications.redraw_title();
|
notifications.redraw_title();
|
||||||
notifications.hide_or_show_history_limit_message(home_msg_list);
|
notifications.hide_or_show_history_limit_message(home_msg_list);
|
||||||
|
$(".all-messages-search-caution").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.deactivate = function () {
|
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%);
|
stroke: hsl(0, 0%, 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-limited-box {
|
.history-limited-box,
|
||||||
|
.all-messages-search-caution {
|
||||||
background-color: hsla(0, 0%, 0%, 0.2);
|
background-color: hsla(0, 0%, 0%, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,8 +86,17 @@ p.n-margin {
|
|||||||
.history-limited-box {
|
.history-limited-box {
|
||||||
color: hsl(16, 60%, 45%);
|
color: hsl(16, 60%, 45%);
|
||||||
border: 1px solid hsl(16, 60%, 45%);
|
border: 1px solid hsl(16, 60%, 45%);
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 0 2px hsl(16, 60%, 45%);
|
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;
|
display: none;
|
||||||
height: 28x;
|
height: 28x;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
|||||||
@@ -18,6 +18,16 @@
|
|||||||
{% endtrans %}
|
{% endtrans %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</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="loading_more_messages_indicator"></div>
|
||||||
<div id="page_loading_indicator"></div>
|
<div id="page_loading_indicator"></div>
|
||||||
<div id="first_run_message" class="empty_feed_notice">
|
<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
|
## Messages sent before you joined
|
||||||
|
|
||||||
In most cases, Zulip only searches messages that you received. In particular,
|
Zulip's [stream permissions](/help/stream-permissions) model allows
|
||||||
this means Zulip will not search messages sent before you joined.
|
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
|
By default, Zulip searches messages in your personal history,
|
||||||
is either public or [private with shared history](/help/stream-permissions),
|
i.e. the messages you actually received.
|
||||||
Zulip will search the entire history of the stream, including messages
|
|
||||||
that were sent before you joined.
|
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).
|
||||||
|
|||||||
Reference in New Issue
Block a user