mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-07 15:54:26 +02:00
Create event for check_item_notification hook
This commit is contained in:
parent
76c3eeb96e
commit
f0273a618c
5 changed files with 14 additions and 2 deletions
|
@ -59,6 +59,7 @@ final class HookEventBridge
|
|||
ArrayFilterEvent::ITEM_TAGGED => 'tagged',
|
||||
ArrayFilterEvent::DISPLAY_ITEM => 'display_item',
|
||||
ArrayFilterEvent::CACHE_ITEM => 'put_item_in_cache',
|
||||
ArrayFilterEvent::CHECK_ITEM_NOTIFICATION => 'check_item_notification',
|
||||
ArrayFilterEvent::DETECT_LANGUAGES => 'detect_languages',
|
||||
ArrayFilterEvent::RENDER_LOCATION => 'render_location',
|
||||
ArrayFilterEvent::ITEM_PHOTO_MENU => 'item_photo_menu',
|
||||
|
@ -130,6 +131,7 @@ final class HookEventBridge
|
|||
ArrayFilterEvent::ITEM_TAGGED => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::DISPLAY_ITEM => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::CACHE_ITEM => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::CHECK_ITEM_NOTIFICATION => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::DETECT_LANGUAGES => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::RENDER_LOCATION => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::ITEM_PHOTO_MENU => 'onArrayFilterEvent',
|
||||
|
|
|
@ -68,6 +68,8 @@ final class ArrayFilterEvent extends Event
|
|||
|
||||
public const CACHE_ITEM = 'friendica.data.cache_item';
|
||||
|
||||
public const CHECK_ITEM_NOTIFICATION = 'friendica.data.check_item_notification';
|
||||
|
||||
public const DETECT_LANGUAGES = 'friendica.data.detect_languages';
|
||||
|
||||
public const RENDER_LOCATION = 'friendica.data.render_location';
|
||||
|
|
|
@ -9,10 +9,10 @@ namespace Friendica\Model\Post;
|
|||
|
||||
use BadMethodCallException;
|
||||
use Exception;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Event\ArrayFilterEvent;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
|
@ -396,7 +396,12 @@ class UserNotification
|
|||
$profiles = [$owner['nurl']];
|
||||
|
||||
$notification_data = ['uid' => $uid, 'profiles' => []];
|
||||
Hook::callAll('check_item_notification', $notification_data);
|
||||
|
||||
$eventDispatcher = DI::eventDispatcher();
|
||||
|
||||
$notification_data = $eventDispatcher->dispatch(
|
||||
new ArrayFilterEvent(ArrayFilterEvent::CHECK_ITEM_NOTIFICATION, $notification_data),
|
||||
)->getArray();
|
||||
|
||||
// Normalize the connector profiles
|
||||
foreach ($notification_data['profiles'] as $profile) {
|
||||
|
|
|
@ -48,6 +48,7 @@ class HookEventBridgeTest extends TestCase
|
|||
ArrayFilterEvent::ITEM_TAGGED => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::DISPLAY_ITEM => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::CACHE_ITEM => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::CHECK_ITEM_NOTIFICATION => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::DETECT_LANGUAGES => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::RENDER_LOCATION => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::ITEM_PHOTO_MENU => 'onArrayFilterEvent',
|
||||
|
@ -460,6 +461,7 @@ class HookEventBridgeTest extends TestCase
|
|||
[ArrayFilterEvent::ITEM_TAGGED, 'tagged'],
|
||||
[ArrayFilterEvent::DISPLAY_ITEM, 'display_item'],
|
||||
[ArrayFilterEvent::CACHE_ITEM, 'put_item_in_cache'],
|
||||
[ArrayFilterEvent::CHECK_ITEM_NOTIFICATION, 'check_item_notification'],
|
||||
[ArrayFilterEvent::DETECT_LANGUAGES, 'detect_languages'],
|
||||
[ArrayFilterEvent::RENDER_LOCATION, 'render_location'],
|
||||
[ArrayFilterEvent::ITEM_PHOTO_MENU, 'item_photo_menu'],
|
||||
|
|
|
@ -45,6 +45,7 @@ class ArrayFilterEventTest extends TestCase
|
|||
[ArrayFilterEvent::ITEM_TAGGED, 'friendica.data.item_tagged'],
|
||||
[ArrayFilterEvent::DISPLAY_ITEM, 'friendica.data.display_item'],
|
||||
[ArrayFilterEvent::CACHE_ITEM, 'friendica.data.cache_item'],
|
||||
[ArrayFilterEvent::CHECK_ITEM_NOTIFICATION, 'friendica.data.check_item_notification'],
|
||||
[ArrayFilterEvent::DETECT_LANGUAGES, 'friendica.data.detect_languages'],
|
||||
[ArrayFilterEvent::RENDER_LOCATION, 'friendica.data.render_location'],
|
||||
[ArrayFilterEvent::ITEM_PHOTO_MENU, 'friendica.data.item_photo_menu'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue