Add events for follow, revoke_follow, block and unblock hooks

This commit is contained in:
Art4 2025-03-13 14:02:35 +00:00
parent 4d96875656
commit 10e4f4bf36
6 changed files with 59 additions and 10 deletions

View file

@ -22,6 +22,7 @@ use Friendica\Core\Worker;
use Friendica\Database\Database;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Event\ArrayFilterEvent;
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
use Friendica\Network\HTTPException\NotFoundException;
@ -3144,7 +3145,11 @@ class Contact
$arr = ['url' => $url, 'uid' => $uid, 'contact' => []];
Hook::callAll('follow', $arr);
$eventDispatcher = DI::eventDispatcher();
$arr = $eventDispatcher->dispatch(
new ArrayFilterEvent(ArrayFilterEvent::FOLLOW_CONTACT, $arr),
)->getArray();
if (empty($arr)) {
$result['message'] = DI::l10n()->t('The contact could not be added. Please check the relevant network credentials in your Settings -> Social Networks page.');