mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	message_flags: Filter msgs having (or not) the flag before updating.
We were blindly adding / removing flag from UserMessages without check if they even need to be updated. This caused server to repeatedly update flags for messages which already had been updated, creating a confusion for other clients like mobile. Fixes #22164
This commit is contained in:
		@@ -38,13 +38,13 @@ def update_message_flags(
 | 
			
		||||
    request_notes = RequestNotes.get_notes(request)
 | 
			
		||||
    assert request_notes.log_data is not None
 | 
			
		||||
 | 
			
		||||
    count = do_update_message_flags(user_profile, operation, flag, messages)
 | 
			
		||||
    count, updated_message_ids = do_update_message_flags(user_profile, operation, flag, messages)
 | 
			
		||||
 | 
			
		||||
    target_count_str = str(len(messages))
 | 
			
		||||
    log_data_str = f"[{operation} {flag}/{target_count_str}] actually {count}"
 | 
			
		||||
    request_notes.log_data["extra"] = log_data_str
 | 
			
		||||
 | 
			
		||||
    return json_success(request, data={"messages": messages})
 | 
			
		||||
    return json_success(request, data={"messages": updated_message_ids})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@has_request_variables
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user