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

@ -187,7 +187,7 @@ class Protocol
$eventDispatcher = DI::eventDispatcher();
$hook_data = $eventDispatcher->dispatch(
new ArrayFilterEvent(ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW, $hook_data),
new ArrayFilterEvent(ArrayFilterEvent::UNFOLLOW_CONTACT, $hook_data),
)->getArray();
return $hook_data['result'];
@ -223,7 +223,12 @@ class Protocol
'uid' => $owner['uid'],
'result' => null,
];
Hook::callAll('revoke_follow', $hook_data);
$eventDispatcher = DI::eventDispatcher();
$hook_data = $eventDispatcher->dispatch(
new ArrayFilterEvent(ArrayFilterEvent::REVOKE_FOLLOW_CONTACT, $hook_data),
)->getArray();
return $hook_data['result'];
}
@ -261,7 +266,12 @@ class Protocol
'uid' => $uid,
'result' => null,
];
Hook::callAll('block', $hook_data);
$eventDispatcher = DI::eventDispatcher();
$hook_data = $eventDispatcher->dispatch(
new ArrayFilterEvent(ArrayFilterEvent::BLOCK_CONTACT, $hook_data),
)->getArray();
return $hook_data['result'];
}
@ -300,7 +310,12 @@ class Protocol
'uid' => $uid,
'result' => null,
];
Hook::callAll('unblock', $hook_data);
$eventDispatcher = DI::eventDispatcher();
$hook_data = $eventDispatcher->dispatch(
new ArrayFilterEvent(ArrayFilterEvent::UNBLOCK_CONTACT, $hook_data),
)->getArray();
return $hook_data['result'];
}