mirror of https://github.com/zulip/zulip.git
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:
parent
bab1dc5d9c
commit
59a743de01
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue