mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-27 15:59:29 +00:00
Fix issue : friends posts appeared in latest posts even if friendship was not accepted.
This commit is contained in:
parent
82c47e7b11
commit
0d0878daa9
@ -29,9 +29,10 @@ class friends {
|
|||||||
*
|
*
|
||||||
* @param int $userID The ID of the user
|
* @param int $userID The ID of the user
|
||||||
* @param int $friendID The ID of a specific friend (default -1)
|
* @param int $friendID The ID of a specific friend (default -1)
|
||||||
|
* @param bool $only_accepted Specify if only the accepted friends must be selected (default: FALSE)
|
||||||
* @return array The list of the friends of the user (Friend objects)
|
* @return array The list of the friends of the user (Friend objects)
|
||||||
*/
|
*/
|
||||||
public function getList(int $userID, int $friendID = -1) : array {
|
public function getList(int $userID, int $friendID = -1, bool $only_accepted = FALSE) : array {
|
||||||
|
|
||||||
//Prepare the request on the database
|
//Prepare the request on the database
|
||||||
$tableName = $this->friendsTable.", utilisateurs";
|
$tableName = $this->friendsTable.", utilisateurs";
|
||||||
@ -44,6 +45,11 @@ class friends {
|
|||||||
$condValues[] = $friendID;
|
$condValues[] = $friendID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Check if only accepted friendship must be selected
|
||||||
|
if($only_accepted){
|
||||||
|
$condition .= " AND actif = 1 ";
|
||||||
|
}
|
||||||
|
|
||||||
//Complete conditions
|
//Complete conditions
|
||||||
$condition .= "ORDER BY utilisateurs.last_activity DESC";
|
$condition .= "ORDER BY utilisateurs.last_activity DESC";
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ class Posts {
|
|||||||
$visibilityLevel = self::VISIBILITY_FRIENDS;
|
$visibilityLevel = self::VISIBILITY_FRIENDS;
|
||||||
|
|
||||||
//Get the list of friends of the user
|
//Get the list of friends of the user
|
||||||
$friendsList = components()->friends->getList($userID);
|
$friendsList = components()->friends->getList($userID, -1, TRUE);
|
||||||
|
|
||||||
|
|
||||||
//Prepare the request on the database
|
//Prepare the request on the database
|
||||||
|
Loading…
Reference in New Issue
Block a user