zephyr: Close exemption for stream-link warnings.

For the rare case where you're doing a link to a private
stream from a larger private stream that is a superset of
the former, we have bypassed warnings that you are linking
to a private stream.

I'm not sure we need this exemption for any situation
(just let the user bypass the warning), but we definitely
don't want false positives for the exemption.

For now I am closing down this loophole specifically for
Zephyr users.

Zephyr users are special in that we might not get
subscriber info on certain streams.

The current behavior for this edge case is a little
unclear.  The current implementation of
peer_data.is_subscriber_subset returns false if both
streams are untracked, but most streams are tracked if we
have a sub for them and just get treated as having an
empty set of subscribers.  And an empty set is a subset of
itself.  Upcoming changes to our server data are gonna
make this edge case even more annoying to maintain.
This commit is contained in:
Steve Howell 2021-01-29 21:26:56 +00:00 committed by Tim Abbott
parent 5a27ed6a72
commit 52281462e2
1 changed files with 9 additions and 5 deletions

View File

@ -980,11 +980,15 @@ exports.warn_if_private_stream_is_linked = function (linked_stream) {
return;
}
if (peer_data.is_subscriber_subset(compose_stream.stream_id, linked_stream.stream_id)) {
// Don't warn if subscribers list of current compose_stream is
// a subset of linked_stream's subscribers list, because
// everyone will be subscribed to the linked stream and so
// knows it exists.
// Don't warn if subscribers list of current compose_stream is
// a subset of linked_stream's subscribers list, because
// everyone will be subscribed to the linked stream and so
// knows it exists. (But always warn Zephyr users, since
// we may not know their stream's subscribers.)
if (
peer_data.is_subscriber_subset(compose_stream.stream_id, linked_stream.stream_id) &&
!page_params.realm_is_zephyr_mirror_realm
) {
return;
}