mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-11-04 01:24:04 +00:00 
			
		
		
		
	Can remove the user from all its conversations
This commit is contained in:
		@@ -324,6 +324,9 @@ pub fn delete(user_id: &UserID) -> ResultBoxError {
 | 
			
		||||
    // Delete all conversation messages
 | 
			
		||||
    conversations_helper::delete_all_user_messages(user_id)?;
 | 
			
		||||
 | 
			
		||||
    // Remove the user from all its conversations
 | 
			
		||||
    conversations_helper::delete_all_user_conversations(user_id)?;
 | 
			
		||||
 | 
			
		||||
    // TODO : continue work here
 | 
			
		||||
 | 
			
		||||
    Ok(())
 | 
			
		||||
 
 | 
			
		||||
@@ -269,6 +269,15 @@ pub fn delete_all_user_messages(user_id: &UserID) -> ResultBoxError {
 | 
			
		||||
    Ok(())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Remove the user from all the conversations he belongs to
 | 
			
		||||
pub fn delete_all_user_conversations(user_id: &UserID) -> ResultBoxError {
 | 
			
		||||
    for conversation in &get_list_user(user_id)? {
 | 
			
		||||
        remove_user_from_conversation(user_id, conversation.id)?;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Ok(())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Get the entire list of messages of a given conversation
 | 
			
		||||
pub fn get_all_messages(conv_id: u64) -> ResultBoxError<Vec<ConversationMessage>> {
 | 
			
		||||
    database::QueryInfo::new(CONV_MESSAGES_TABLE)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user