Add event for unfollow hook
This commit is contained in:
parent
aeaa488d1b
commit
4d96875656
4 changed files with 12 additions and 1 deletions
|
@ -62,6 +62,7 @@ final class HookEventBridge
|
|||
ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW => 'support_follow',
|
||||
ArrayFilterEvent::PROTOCOL_SUPPORTS_REVOKE_FOLLOW => 'support_revoke_follow',
|
||||
ArrayFilterEvent::PROTOCOL_SUPPORTS_PROBE => 'support_probe',
|
||||
ArrayFilterEvent::UNFOLLOW => 'unfollow',
|
||||
HtmlFilterEvent::HEAD => 'head',
|
||||
HtmlFilterEvent::FOOTER => 'footer',
|
||||
HtmlFilterEvent::PAGE_HEADER => 'page_header',
|
||||
|
@ -104,6 +105,7 @@ final class HookEventBridge
|
|||
ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::PROTOCOL_SUPPORTS_REVOKE_FOLLOW => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::PROTOCOL_SUPPORTS_PROBE => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::UNFOLLOW => 'onArrayFilterEvent',
|
||||
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
|
||||
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
|
||||
HtmlFilterEvent::PAGE_HEADER => 'onHtmlFilterEvent',
|
||||
|
|
|
@ -183,7 +183,12 @@ class Protocol
|
|||
'uid' => $owner['uid'],
|
||||
'result' => null,
|
||||
];
|
||||
Hook::callAll('unfollow', $hook_data);
|
||||
|
||||
$eventDispatcher = DI::eventDispatcher();
|
||||
|
||||
$hook_data = $eventDispatcher->dispatch(
|
||||
new ArrayFilterEvent(ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW, $hook_data),
|
||||
)->getArray();
|
||||
|
||||
return $hook_data['result'];
|
||||
}
|
||||
|
|
|
@ -62,6 +62,8 @@ final class ArrayFilterEvent extends Event
|
|||
|
||||
public const PROTOCOL_SUPPORTS_PROBE = 'friendica.data.protocol_supports_probe';
|
||||
|
||||
public const UNFOLLOW = 'friendica.data.unfollow';
|
||||
|
||||
private array $array;
|
||||
|
||||
public function __construct(string $name, array $array)
|
||||
|
|
|
@ -51,6 +51,7 @@ class HookEventBridgeTest extends TestCase
|
|||
ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::PROTOCOL_SUPPORTS_REVOKE_FOLLOW => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::PROTOCOL_SUPPORTS_PROBE => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::UNFOLLOW => 'onArrayFilterEvent',
|
||||
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
|
||||
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
|
||||
HtmlFilterEvent::PAGE_HEADER => 'onHtmlFilterEvent',
|
||||
|
@ -278,6 +279,7 @@ class HookEventBridgeTest extends TestCase
|
|||
[ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW, 'support_follow'],
|
||||
[ArrayFilterEvent::PROTOCOL_SUPPORTS_REVOKE_FOLLOW, 'support_revoke_follow'],
|
||||
[ArrayFilterEvent::PROTOCOL_SUPPORTS_PROBE, 'support_probe'],
|
||||
[ArrayFilterEvent::UNFOLLOW, 'unfollow'],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue