mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 21:39:21 +00:00
Update the way group last activity is retrieved
This commit is contained in:
parent
7902981c22
commit
6365e2d2b3
@ -9,7 +9,7 @@ use crate::data::group_id::GroupID;
|
||||
use crate::data::group_member::{GroupMember, GroupMembershipLevel};
|
||||
use crate::data::new_group::NewGroup;
|
||||
use crate::data::user::UserID;
|
||||
use crate::helpers::{database, likes_helper, notifications_helper, posts_helper, conversations_helper};
|
||||
use crate::helpers::{conversations_helper, database, likes_helper, notifications_helper, posts_helper};
|
||||
use crate::helpers::likes_helper::LikeType;
|
||||
use crate::utils::date_utils::time;
|
||||
|
||||
@ -378,16 +378,15 @@ pub fn get_last_activity(user_id: &UserID, group_id: &GroupID) -> ResultBoxError
|
||||
.set_limit(1)
|
||||
.get_group(group_id)?;
|
||||
|
||||
match last_post.first() {
|
||||
None => {
|
||||
// No post was found
|
||||
Ok(0)
|
||||
let mut last_activity = last_post.first().map(|f| f.time_create).unwrap_or(0);
|
||||
|
||||
for conv in conversations_helper::get_list_group(group_id)? {
|
||||
if conv.last_activity > last_activity {
|
||||
last_activity = conv.last_activity;
|
||||
}
|
||||
}
|
||||
|
||||
Some(p) => {
|
||||
Ok(p.time_create)
|
||||
}
|
||||
}
|
||||
Ok(last_activity)
|
||||
}
|
||||
|
||||
/// Set new settings to the group, except group logo
|
||||
|
Loading…
Reference in New Issue
Block a user