X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FModel%2FSubscription.php;h=0d8f346d18281dfd80035b4b1c0c14c2f7fe2768;hb=171354181d7effb5f292b85531ee587c809a8942;hp=59e71307f5ffb4092bf67fbe132ec823e65f63bc;hpb=2108be7e07792a069ef0650126ac22d470a4b7fc;p=friendica.git diff --git a/src/Model/Subscription.php b/src/Model/Subscription.php index 59e71307f5..0d8f346d18 100644 --- a/src/Model/Subscription.php +++ b/src/Model/Subscription.php @@ -1,6 +1,6 @@ $nid]); + $type = \Friendica\Factory\Api\Mastodon\Notification::getType($Notification); - $type = Notification::getType($notification); + $desktop_notification = !in_array($type, [Notification::TYPE_RESHARE, Notification::TYPE_LIKE]); - $desktop_notification = !in_array($type, ['reblog', 'favourite']); - - if (DI::pConfig()->get($notification['uid'], 'system', 'notify_like') && ($type == 'favourite')) { + if (DI::pConfig()->get($Notification->uid, 'system', 'notify_like') && ($type == Notification::TYPE_LIKE)) { $desktop_notification = true; } - if (DI::pConfig()->get($notification['uid'], 'system', 'notify_announce') && ($type == 'reblog')) { + if (DI::pConfig()->get($Notification->uid, 'system', 'notify_announce') && ($type == Notification::TYPE_RESHARE)) { $desktop_notification = true; } if ($desktop_notification) { - notification_from_array($notification); + DI::notify()->createFromNotification($Notification); } if (empty($type)) { return; } - $subscriptions = DBA::select('subscription', [], ['uid' => $notification['uid'], $type => true]); + $subscriptions = DBA::select('subscription', [], ['uid' => $Notification->uid, $type => true]); while ($subscription = DBA::fetch($subscriptions)) { Logger::info('Push notification', ['id' => $subscription['id'], 'uid' => $subscription['uid'], 'type' => $type]); - Worker::add(PRIORITY_HIGH, 'PushSubscription', $subscription['id'], $nid); + Worker::add(PRIORITY_HIGH, 'PushSubscription', $subscription['id'], $Notification->id); } DBA::close($subscriptions); }