mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 03:41:58 +00:00
search: Check if user can access stream topics before fetching history.
When building search suggestions for stream topics, instead of assuming that the user has access to the stream's topic history from the server, we check whether the user has access to the stream's topics.
This commit is contained in:
committed by
Tim Abbott
parent
c4823bfd03
commit
cba8738eea
@@ -530,6 +530,13 @@ export function can_toggle_subscription(sub) {
|
||||
);
|
||||
}
|
||||
|
||||
export function can_access_topic_history(sub) {
|
||||
// Anyone can access topic history for web-public streams and
|
||||
// subscriptions; additionally, members can access history for
|
||||
// public streams.
|
||||
return sub.is_web_public || can_toggle_subscription(sub);
|
||||
}
|
||||
|
||||
export function can_preview(sub) {
|
||||
return sub.subscribed || !sub.invite_only || sub.previously_subscribed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user