[fractal] Fix wrong messages being replaced
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal] Fix wrong messages being replaced
- Date: Wed, 17 Feb 2021 01:50:32 +0000 (UTC)
commit db015b6d474f6126765b0fd05d80836adc963af0
Author: Kai A. Hiller <V02460 gmail com>
Date: Fri Feb 12 18:13:22 2021 +0100
Fix wrong messages being replaced
The index used by replace_item is now determined from the right end of
the message list.
fractal-gtk/src/widgets/room_history.rs | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/fractal-gtk/src/widgets/room_history.rs b/fractal-gtk/src/widgets/room_history.rs
index 6083686e..d34dbc7f 100644
--- a/fractal-gtk/src/widgets/room_history.rs
+++ b/fractal-gtk/src/widgets/room_history.rs
@@ -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()?;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]