mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	buddy list: Make small realms show all users.
For small-ish realms (<= 250 users), we ensure that the presence info includes all realm users the front end knows about, even in cases where the server sends down a slimmed version of presence data. We make the users "offline" by default, of course. This commit sets us up to optimize larger realms without concerns of breaking small realms. Small realms may want to continue to show all users, even users who may have been offline several weeks, since it doesn't clutter their API as much as it would for big realms.
This commit is contained in:
		@@ -66,16 +66,23 @@ var norbert = {
 | 
			
		||||
    full_name: 'Norbert Oswald',
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
global.people.add(alice);
 | 
			
		||||
global.people.add(fred);
 | 
			
		||||
global.people.add(jill);
 | 
			
		||||
global.people.add(mark);
 | 
			
		||||
global.people.add(norbert);
 | 
			
		||||
global.people.add(me);
 | 
			
		||||
global.people.initialize_current_user(me.user_id);
 | 
			
		||||
var zoe = {
 | 
			
		||||
    email: 'zoe@example.com',
 | 
			
		||||
    user_id: 6,
 | 
			
		||||
    full_name: 'Zoe Yang',
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
var people = global.people;
 | 
			
		||||
 | 
			
		||||
people.add_in_realm(alice);
 | 
			
		||||
people.add_in_realm(fred);
 | 
			
		||||
people.add_in_realm(jill);
 | 
			
		||||
people.add_in_realm(mark);
 | 
			
		||||
people.add_in_realm(norbert);
 | 
			
		||||
people.add_in_realm(zoe);
 | 
			
		||||
people.add_in_realm(me);
 | 
			
		||||
people.initialize_current_user(me.user_id);
 | 
			
		||||
 | 
			
		||||
var activity = require('js/activity.js');
 | 
			
		||||
var compose_fade = require('js/compose_fade.js');
 | 
			
		||||
 | 
			
		||||
@@ -289,6 +296,10 @@ global.compile_template('user_presence_rows');
 | 
			
		||||
    assert.deepEqual(presence.presence_info[fred.user_id],
 | 
			
		||||
        { status: 'idle', mobile: false, last_active: 500}
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    assert.deepEqual(presence.presence_info[zoe.user_id],
 | 
			
		||||
        { status: 'offline', mobile: false, last_active: undefined}
 | 
			
		||||
    );
 | 
			
		||||
}());
 | 
			
		||||
 | 
			
		||||
presence.presence_info = {};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user