Merge branch 'cleanup' into 'master'
roomhistory: remove shown message count See merge request World/fractal!267
This commit is contained in:
commit
e501ff0cdd
3 changed files with 1 additions and 21 deletions
|
@ -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::<Vec<Message>>();
|
||||
if self.shown_messages < msgs.len() {
|
||||
let msgs = msgs.iter().rev()
|
||||
.skip(self.shown_messages)
|
||||
.take(globals::INITIAL_MESSAGES)
|
||||
.collect::<Vec<&Message>>();
|
||||
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
|
||||
|
|
|
@ -59,7 +59,6 @@ pub struct AppOp {
|
|||
pub syncing: bool,
|
||||
pub msg_queue: Vec<TmpMsg>,
|
||||
pub sending_message: bool,
|
||||
shown_messages: usize,
|
||||
pub last_viewed_messages: HashMap<String, String>,
|
||||
pub first_new_messages: HashMap<String, Option<Message>>,
|
||||
|
||||
|
@ -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,
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue