Skip to content

Commit 5228146

Browse files
showelltimabbott
authored andcommitted
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.
1 parent 5a27ed6 commit 5228146

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

static/js/compose.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -980,11 +980,15 @@ exports.warn_if_private_stream_is_linked = function (linked_stream) {
980980
return;
981981
}
982982

983-
if (peer_data.is_subscriber_subset(compose_stream.stream_id, linked_stream.stream_id)) {
984-
// Don't warn if subscribers list of current compose_stream is
985-
// a subset of linked_stream's subscribers list, because
986-
// everyone will be subscribed to the linked stream and so
987-
// knows it exists.
983+
// Don't warn if subscribers list of current compose_stream is
984+
// a subset of linked_stream's subscribers list, because
985+
// everyone will be subscribed to the linked stream and so
986+
// knows it exists. (But always warn Zephyr users, since
987+
// we may not know their stream's subscribers.)
988+
if (
989+
peer_data.is_subscriber_subset(compose_stream.stream_id, linked_stream.stream_id) &&
990+
!page_params.realm_is_zephyr_mirror_realm
991+
) {
988992
return;
989993
}
990994

0 commit comments

Comments
 (0)