mirror of
https://github.com/friendica/friendica
synced 2025-04-27 08:30:10 +00:00
Added processing of incoming block notices
This commit is contained in:
parent
79526564ca
commit
c0b3c527d6
6 changed files with 99 additions and 4 deletions
|
@ -311,4 +311,48 @@ class User
|
|||
|
||||
return $collapsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set/Release that the user is blocked by the contact
|
||||
*
|
||||
* @param int $cid Either public contact id or user's contact id
|
||||
* @param int $uid User ID
|
||||
* @param boolean $blocked Is the user blocked or unblocked by the contact?
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function setIsBlocked($cid, $uid, $blocked)
|
||||
{
|
||||
$cdata = Contact::getPublicAndUserContactID($cid, $uid);
|
||||
if (empty($cdata)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DBA::update('user-contact', ['is-blocked' => $blocked], ['cid' => $cdata['public'], 'uid' => $uid], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the user is blocked by the contact
|
||||
*
|
||||
* @param int $cid Either public contact id or user's contact id
|
||||
* @param int $uid User ID
|
||||
*
|
||||
* @return boolean Is the user blocked or unblocked by the contact?
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function isIsBlocked($cid, $uid)
|
||||
{
|
||||
$cdata = Contact::getPublicAndUserContactID($cid, $uid);
|
||||
if (empty($cdata)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($cdata['public'])) {
|
||||
$public_contact = DBA::selectFirst('user-contact', ['is-blocked'], ['cid' => $cdata['public'], 'uid' => $uid]);
|
||||
if (DBA::isResult($public_contact)) {
|
||||
return $public_contact['is-blocked'];
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue