mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	Add blueslip warnings to stream_data functions.
Warn inside these functions when you get data on streams that you are not subscribed to: add_subscriber remove_subscriber user_is_subscribed The back end should be smart enough not to spam us with subscriber info that we don't care about. (imported from commit b27644be2abc37c11ddff884ef392ea208bd1bd3)
This commit is contained in:
		@@ -113,6 +113,7 @@ exports.add_subscriber = function (stream_name, user_email) {
 | 
			
		||||
        // 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.warning("We got an add_subscriber call for a non-existent or unsubscribed stream.");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    sub.subscribers.set(user_email, true);
 | 
			
		||||
@@ -124,6 +125,7 @@ exports.remove_subscriber = function (stream_name, user_email) {
 | 
			
		||||
        // 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.warning("We got a remove_subscriber call for a non-existent or unsubscribed stream.");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    sub.subscribers.del(user_email);
 | 
			
		||||
@@ -135,6 +137,7 @@ exports.user_is_subscribed = function (stream_name, user_email) {
 | 
			
		||||
        // If we don't know about the stream, or we ourselves are not
 | 
			
		||||
        // subscribed, we can't keep track of the subscriber list in general,
 | 
			
		||||
        // so we return undefined (treated as falsy if not explicitly handled).
 | 
			
		||||
        blueslip.warning("We got a user_is_subscribed call for a non-existent or unsubscribed stream.");
 | 
			
		||||
        return undefined;
 | 
			
		||||
    }
 | 
			
		||||
    return sub.subscribers.has(user_email);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user