diff --git a/fractal-gtk/src/appop/message.rs b/fractal-gtk/src/appop/message.rs index 95c50db1..295f5bab 100644 --- a/fractal-gtk/src/appop/message.rs +++ b/fractal-gtk/src/appop/message.rs @@ -13,7 +13,6 @@ use app::App; use appop::room::Force; use glib; -use globals; use widgets; use uitypes::MessageContent; use uitypes::RowType; @@ -133,7 +132,6 @@ impl AppOp { } } - self.shown_messages += 1; } } @@ -462,20 +460,7 @@ impl AppOp { self.load_more_spn.start(); if let Some(r) = self.rooms.get(&self.active_room.clone().unwrap_or_default()) { - let msgs = r.messages.iter().filter(|x| !x.redacted).cloned().collect::>(); - if self.shown_messages < msgs.len() { - let msgs = msgs.iter().rev() - .skip(self.shown_messages) - .take(globals::INITIAL_MESSAGES) - .collect::>(); - for msg in msgs.iter() { - let command = InternalCommand::AddRoomMessage((*msg).clone(), - MsgPos::Top, - self.is_first_new(&msg)); - self.internal.send(command).unwrap(); - } - self.internal.send(InternalCommand::LoadMoreNormal).unwrap(); - } else if let Some(prev_batch) = r.prev_batch.clone() { + if let Some(prev_batch) = r.prev_batch.clone() { self.backend.send(BKCommand::GetRoomMessages(r.id.clone(), prev_batch)).unwrap(); } else if let Some(msg) = r.messages.iter().next() { // no prev_batch so we use the last message to calculate that in the backend diff --git a/fractal-gtk/src/appop/mod.rs b/fractal-gtk/src/appop/mod.rs index 42a21b59..6a9af4d4 100644 --- a/fractal-gtk/src/appop/mod.rs +++ b/fractal-gtk/src/appop/mod.rs @@ -59,7 +59,6 @@ pub struct AppOp { pub syncing: bool, pub msg_queue: Vec, pub sending_message: bool, - shown_messages: usize, pub last_viewed_messages: HashMap, pub first_new_messages: HashMap>, @@ -128,7 +127,6 @@ impl AppOp { syncing: false, msg_queue: vec![], sending_message: false, - shown_messages: 0, last_viewed_messages: HashMap::new(), first_new_messages: HashMap::new(), state: AppState::Login, diff --git a/fractal-gtk/src/appop/room.rs b/fractal-gtk/src/appop/room.rs index 53a1955b..d99197e3 100644 --- a/fractal-gtk/src/appop/room.rs +++ b/fractal-gtk/src/appop/room.rs @@ -198,9 +198,6 @@ impl AppOp { } } - /* FIXME: We show all messages always therefore we don't need to track how many messages we show */ - self.shown_messages = messages.len(); - /* make sure we remove the old room history first, because the lazy loading could try to * load messages */ if let Some(history) = self.history.take() {