mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	reify_message_id: Save id on most up-to-date message object.
Previously we relied on `echo.reify_message_id` to set the new `id` and `locally_echoed` value, but it was setting this on the message stored in `waiting_for_id`, which isn't guaranteed to be the same as the message in the message store. Once `process_new_message` stops mutating the message it gets and returns a new message object, this would have caused a bug.
This commit is contained in:
		@@ -275,6 +275,8 @@ export function update_status_emoji_info(
 | 
				
			|||||||
export function reify_message_id({old_id, new_id}: {old_id: number; new_id: number}): void {
 | 
					export function reify_message_id({old_id, new_id}: {old_id: number; new_id: number}): void {
 | 
				
			||||||
    const message = stored_messages.get(old_id);
 | 
					    const message = stored_messages.get(old_id);
 | 
				
			||||||
    if (message !== undefined) {
 | 
					    if (message !== undefined) {
 | 
				
			||||||
 | 
					        message.id = new_id;
 | 
				
			||||||
 | 
					        message.locally_echoed = false;
 | 
				
			||||||
        stored_messages.set(new_id, message);
 | 
					        stored_messages.set(new_id, message);
 | 
				
			||||||
        stored_messages.delete(old_id);
 | 
					        stored_messages.delete(old_id);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user