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(), )?; }