mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-27 07:49:27 +00:00
Can get the number of pending calls for a user
This commit is contained in:
parent
e41cf0161e
commit
9d1371fd81
@ -50,6 +50,12 @@ class notificationsController {
|
||||
if(postBool("friends_request"))
|
||||
$data["friends_request"] = components()->friends->count_requests(userID);
|
||||
|
||||
|
||||
//Include pending calls if required
|
||||
if(isset($_POST["include_calls"]))
|
||||
if(postBool("include_calls"))
|
||||
$data["calls"] = components()->calls->countPendingResponsesForUser(userID);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
@ -147,6 +147,22 @@ class CallsComponents {
|
||||
return count($entries) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count and return the number of pending calls for a user
|
||||
*
|
||||
* @param $userID The ID of the target user
|
||||
* @return int The number of pending calls for the user
|
||||
*/
|
||||
public function countPendingResponsesForUser(int $userID) : int {
|
||||
|
||||
return db()->count(
|
||||
self::CALLS_MEMBERS_TABLE,
|
||||
"WHERE user_id = ? AND user_accepted = ?",
|
||||
array($userID, CallMemberInformation::USER_UNKNOWN)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the response of a member to a call
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user