stream settings: Fix exceptions when rerendering subscribers.

If another user subscribed to or unsubscribed from a stream while the
current user was not subscribed, we previously would attempt to
rerender the subscriber counts for that stream, even though they
weren't rendered at all in the first place; this would trigger
blueslip errors from the expectOne() check in this function.

Fixes #8720.
This commit is contained in:
Tim Abbott
2018-03-19 10:28:24 -07:00
parent 2cbfcbb740
commit 1e453981a3

View File

@@ -150,6 +150,10 @@ exports.set_color = function (stream_id, color) {
};
exports.rerender_subscribers_count = function (sub, just_subscribed) {
if (!overlays.streams_open()) {
// If the streams overlay isn't open, we don't need to rerender anything.
return;
}
var stream_row = row_for_stream_id(sub.stream_id);
stream_data.update_subscribers_count(sub);
if (!sub.can_access_subscribers || (just_subscribed && sub.invite_only)) {