mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	Extract message.set_read_flag().
This code adds 'read' to message.flags and sets message.unread to false. It's not clear that the boolean message.unread is used in any meaningful way, but we set it to false to avoid confusion. The bankruptcy code was not doing this before. Another quirk that existed before was that you could get two 'read' flags in a message when you declared bankruptcy. It's also plausible that this could happen if you marked a message as read via two different ways. It probably did not cause user-facing bugs, but it would be confusing for troubleshooting. Fixes #5032.
This commit is contained in:
		@@ -4,8 +4,7 @@ var exports = {};
 | 
			
		||||
 | 
			
		||||
exports.mark_all_as_read = function mark_all_as_read(cont) {
 | 
			
		||||
    _.each(message_list.all.all_messages(), function (msg) {
 | 
			
		||||
        msg.flags = msg.flags || [];
 | 
			
		||||
        msg.flags.push('read');
 | 
			
		||||
        unread.set_read_flag(msg);
 | 
			
		||||
    });
 | 
			
		||||
    unread.declare_bankruptcy();
 | 
			
		||||
    unread_ui.update_unread_counts();
 | 
			
		||||
@@ -24,9 +23,7 @@ function process_newly_read_message(message, options) {
 | 
			
		||||
    // This code gets called when a message becomes newly read, whether
 | 
			
		||||
    // due to local things like advancing the pointer, or due to us
 | 
			
		||||
    // getting notified by the server that a message has been read.
 | 
			
		||||
    message.flags = message.flags || [];
 | 
			
		||||
    message.flags.push('read');
 | 
			
		||||
    message.unread = false;
 | 
			
		||||
    unread.set_read_flag(message);
 | 
			
		||||
 | 
			
		||||
    home_msg_list.show_message_as_read(message, options);
 | 
			
		||||
    message_list.all.show_message_as_read(message, options);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user