mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Can remove a previously sent frienship request.
This commit is contained in:
		@@ -208,6 +208,25 @@ class friends {
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Delete a friendship request previously created
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param $userID The ID of the user removing its request
 | 
			
		||||
	 * @param $targetID The ID of the target of the request
 | 
			
		||||
	 * @return TRUE in case of success / false else
 | 
			
		||||
	 */
 | 
			
		||||
	public function remove_request(int $userID, int $targetID) : bool {
 | 
			
		||||
 | 
			
		||||
		//Prepare the request on the database
 | 
			
		||||
		$tableName = $this->friendsTable;
 | 
			
		||||
		$conditions = "ID_personne = ? AND ID_amis = ? AND actif = 0";
 | 
			
		||||
		$values = array($targetID, $userID);
 | 
			
		||||
		
 | 
			
		||||
		//Try to perform the request
 | 
			
		||||
		return CS::get()->db->deleteEntry($tableName, $conditions, $values);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Check wether a user has sent a friendship 
 | 
			
		||||
	 * request to another friend
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user