From cbb12a87e11d0336dba673a7fe28b33231c4e5e3 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 6 Mar 2021 14:41:55 +0100 Subject: [PATCH] Fix bad refresh --- src/controllers/conversations_controller.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/conversations_controller.rs b/src/controllers/conversations_controller.rs index 3eb2af2..6455bc8 100644 --- a/src/controllers/conversations_controller.rs +++ b/src/controllers/conversations_controller.rs @@ -216,11 +216,11 @@ pub fn refresh_single(r: &mut HttpRequestHandler) -> RequestResult { messages.sort_by(|one, two| one.id.cmp(&two.id)); - if messages.len() > 0 { + if messages.len() > 0 && messages.last().unwrap().id > conv.last_message_seen { conversations_helper::mark_user_seen( conv.conv_id, r.user_id_ref()?, - &messages[messages.len() - 1], + &messages.last().unwrap(), )?; }