Fix stream_data.remove_subscriber().

We get events to delete subscribers for streams we are not
necessarily subscribed to, and it is now important to
process those events to produce the correct UI for showing
the number of subscribers to streams.
This commit is contained in:
Steve Howell 2016-10-25 11:06:25 -07:00 committed by Tim Abbott
parent 7b9d1a7824
commit 029682ec41
1 changed files with 2 additions and 5 deletions

View File

@ -120,11 +120,8 @@ exports.add_subscriber = function (stream_name, user_email) {
exports.remove_subscriber = function (stream_name, user_email) {
var sub = exports.get_sub(stream_name);
if (typeof sub === 'undefined' || !sub.subscribed) {
// If we're not subscribed, we don't track this, and shouldn't
// get these events. Likewise, if we don't know about the stream,
// we don't want to track this.
blueslip.warn("We got a remove_subscriber call for a non-existent or unsubscribed stream.");
if (typeof sub === 'undefined') {
blueslip.warn("We got a remove_subscriber call for a non-existent stream " + stream_name);
return;
}
sub.subscribers.del(user_email);