mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-10-31 07:34:45 +00:00 
			
		
		
		
	Update the way group last activity is retrieved
This commit is contained in:
		| @@ -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); | ||||
|  | ||||
|         Some(p) => { | ||||
|             Ok(p.time_create) | ||||
|     for conv in conversations_helper::get_list_group(group_id)? { | ||||
|         if conv.last_activity > last_activity { | ||||
|             last_activity = conv.last_activity; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     Ok(last_activity) | ||||
| } | ||||
|  | ||||
| /// Set new settings to the group, except group logo | ||||
|   | ||||
		Reference in New Issue
	
	Block a user