mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
We now use the same code in all places to get the bucket of user_ids that correspond to a stream, and we consistently treat a stream as having zero subscribers, not an undefined number of subscribers, in the hypothetical case of us asking about a stream that we're not tracking. The behavior for untracked streams has always been problematic, since if a stream is untracked, all bets are off. So now if we don't "track" the stream, the subscriber count is zero. None of our callers distinguish between undefined and zero. And we just consider the stream to be subscribed by a user when add_subscriber is called, even if we haven't been told by stream_data to track the stream. (We also stop returning true/false from add_subscriber, since only test code was looking at it.) We protect against the most likely source of internal-to-the-frontend bugs by adding the assert_number() call. We generally have to assume that the server is sending us sensible data at page load time, or all bets are off. And we have good protections in place for unknown ids in our dispatch code for peer_add/peer_remove events.