mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	We now sweep all active messages for avatar changes and update the message items and re-render, rather than patching the DOM. This avoids some quirks that happen when subsequent messages get sent and we re-render previous messages out of the message store. Our approach here is similar to how we do full-name updates.
		
			
				
	
	
		
			33 lines
		
	
	
		
			862 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			862 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
var message_live_update = (function () {
 | 
						|
 | 
						|
var exports = {};
 | 
						|
 | 
						|
exports.update_stream_name = function (stream_id, new_name) {
 | 
						|
    _.each([home_msg_list, current_msg_list, message_list.all], function (list) {
 | 
						|
        list.update_stream_name(stream_id, new_name);
 | 
						|
    });
 | 
						|
};
 | 
						|
 | 
						|
exports.update_user_full_name = function (user_id, full_name) {
 | 
						|
    _.each([home_msg_list, current_msg_list, message_list.all], function (list) {
 | 
						|
        list.update_user_full_name(user_id, full_name);
 | 
						|
    });
 | 
						|
};
 | 
						|
 | 
						|
exports.update_avatar = function (user_id, avatar_url) {
 | 
						|
    var url = avatar_url;
 | 
						|
    url = people.format_small_avatar_url(url);
 | 
						|
 | 
						|
    _.each([home_msg_list, current_msg_list, message_list.all], function (list) {
 | 
						|
        list.update_user_avatar(user_id, url);
 | 
						|
    });
 | 
						|
};
 | 
						|
 | 
						|
return exports;
 | 
						|
 | 
						|
}());
 | 
						|
if (typeof module !== 'undefined') {
 | 
						|
    module.exports = message_live_update;
 | 
						|
}
 | 
						|
 |