mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Updated method
This commit is contained in:
		@@ -470,19 +470,10 @@ class ConversationsController{
 | 
			
		||||
		if(!CS::get()->components->conversations->userBelongsTo(userID, $conversationID))
 | 
			
		||||
			Rest_fatal_error(401, "Specified user doesn't belongs to the conversation number ".$conversationID." !");
 | 
			
		||||
		
 | 
			
		||||
		//Check if user is the owner of the conversation or not
 | 
			
		||||
		$owner = CS::get()->components->conversations->userIsModerator(userID, $conversationID);
 | 
			
		||||
 | 
			
		||||
		if($owner){
 | 
			
		||||
			//Delete the conversation
 | 
			
		||||
			if(!CS::get()->components->conversations->delete_conversation($conversationID))
 | 
			
		||||
				Rest_fatal_error(500, "Couldn't delete the conversation from the server !");
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			//Delete the membership to the conversation
 | 
			
		||||
			if(!CS::get()->components->conversations->delete_member($conversationID, userID))
 | 
			
		||||
				Rest_fatal_error(500, "Couldn't delete conversation membership !");
 | 
			
		||||
		}
 | 
			
		||||
		//Try to remove the user from the conversation (delete the conversation if the user
 | 
			
		||||
		// is its owner)
 | 
			
		||||
		if(!components()->conversations->removeUserFromConversation(userID, $conversationID))
 | 
			
		||||
			Rest_fatal_error(500, "An error occured while trying to delete the conversation!");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		//The operation is a success
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user