mirror of
https://github.com/friendica/friendica
synced 2025-04-29 09:04:24 +02: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
|
@ -1206,6 +1206,52 @@ class Processor
|
|||
Logger::info('Deleted contact', ['object' => $activity['object_id']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks the user by the contact
|
||||
*
|
||||
* @param array $activity
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function blockPerson($activity)
|
||||
{
|
||||
$cid = Contact::getIdForURL($activity['actor']);
|
||||
if (empty($cid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$uid = User::getIdForURL($activity['object_id']);
|
||||
if (empty($uid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Contact\User::setIsBlocked($cid, $uid, true);
|
||||
|
||||
Logger::info('Contact blocked user', ['contact' => $cid, 'user' => $uid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unblocks the user by the contact
|
||||
*
|
||||
* @param array $activity
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function unblockPerson($activity)
|
||||
{
|
||||
$cid = Contact::getIdForURL($activity['actor']);
|
||||
if (empty($cid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$uid = User::getIdForURL($activity['object_object']);
|
||||
if (empty($uid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Contact\User::setIsBlocked($cid, $uid, false);
|
||||
|
||||
Logger::info('Contact unblocked user', ['contact' => $cid, 'user' => $uid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept a follow request
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue