mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	presence: Suppress some unnecessary blueslip errors for presence.
There was previously a race condition where reload.is_in_progress was set after `activity.js` sent the presence request to the server, but before we process the response; in that race condition, we still shouldn't send blueslip errors to the server.
This commit is contained in:
		@@ -1,8 +1,13 @@
 | 
				
			|||||||
zrequire('people');
 | 
					zrequire('people');
 | 
				
			||||||
zrequire('presence');
 | 
					zrequire('presence');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var return_false = function () { return false; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_global('server_events', {});
 | 
					set_global('server_events', {});
 | 
				
			||||||
set_global('blueslip', {});
 | 
					set_global('blueslip', {});
 | 
				
			||||||
 | 
					set_global('reload', {
 | 
				
			||||||
 | 
					    is_in_progress: return_false,
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var OFFLINE_THRESHOLD_SECS = 140;
 | 
					var OFFLINE_THRESHOLD_SECS = 140;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -104,7 +104,7 @@ exports.set_info = function (presences, server_timestamp) {
 | 
				
			|||||||
        if (!people.is_current_user(this_email)) {
 | 
					        if (!people.is_current_user(this_email)) {
 | 
				
			||||||
            var person = people.get_by_email(this_email);
 | 
					            var person = people.get_by_email(this_email);
 | 
				
			||||||
            if (person === undefined) {
 | 
					            if (person === undefined) {
 | 
				
			||||||
                if (!server_events.suspect_offline) {
 | 
					                if (!(server_events.suspect_offline || reload.is_in_progress())) {
 | 
				
			||||||
                    // If we're online, and we get a user who we don't
 | 
					                    // If we're online, and we get a user who we don't
 | 
				
			||||||
                    // know about in the presence data, throw an error.
 | 
					                    // know about in the presence data, throw an error.
 | 
				
			||||||
                    blueslip.error('Unknown email in presence data: ' + this_email);
 | 
					                    blueslip.error('Unknown email in presence data: ' + this_email);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user