Commit db015b6d authored by Kai Hiller's avatar Kai Hiller Committed by Christopher Davis
Browse files

Fix wrong messages being replaced

The index used by replace_item is now determined from the right end of
the message list.
parent 9e791b74
Pipeline #258078 passed with stages
in 36 minutes and 27 seconds
......@@ -608,19 +608,20 @@ impl RoomHistory {
) -> Option<()> {
let mut rows = self.rows.borrow_mut();
let (i, ref mut msg) = rows
.list
.iter_mut()
.enumerate()
.find_map(|(i, e)| match e {
Element::Message(ref mut itermessage)
if itermessage.msg.id == item.msg.replace
|| itermessage.msg.replace == item.msg.replace =>
{
Some((i, itermessage))
}
_ => None,
})?;
let (i, ref mut msg) =
rows.list
.iter_mut()
.rev()
.enumerate()
.find_map(|(i, e)| match e {
Element::Message(ref mut itermessage)
if itermessage.msg.id == item.msg.replace
|| itermessage.msg.replace == item.msg.replace =>
{
Some((i, itermessage))
}
_ => None,
})?;
item.msg.date = msg.msg.date;
let msg_widget = msg.widget.clone()?;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment