X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FPushSubscription.php;h=895a0d0d2d3f45c23dd7aa075e7a468b1b401fdb;hb=3f309805919671ce0ae22f82f5a751050a07dce4;hp=f07b773198c73090075b356b4210dd41b1e9cfe4;hpb=3d97149007872d69ca43ec955137b887d95239cf;p=friendica.git diff --git a/src/Worker/PushSubscription.php b/src/Worker/PushSubscription.php index f07b773198..895a0d0d2d 100644 --- a/src/Worker/PushSubscription.php +++ b/src/Worker/PushSubscription.php @@ -1,6 +1,6 @@ $sid, 'notification' => $nid]); @@ -48,7 +55,7 @@ class PushSubscription } try { - $Notification = DI::notification()->selectOneById($nid); + $notification = DI::notification()->selectOneById($nid); } catch (NotFoundException $e) { Logger::info('Notification not found', ['notification' => $nid]); return; @@ -60,7 +67,7 @@ class PushSubscription return; } - $user = User::getById($Notification->uid); + $user = User::getById($notification->uid); if (empty($user)) { Logger::info('User not found', ['application' => $subscription['uid']]); return; @@ -68,22 +75,22 @@ class PushSubscription $l10n = DI::l10n()->withLang($user['language']); - if ($Notification->actorId) { - $actor = Contact::getById($Notification->actorId); + if ($notification->actorId) { + $actor = Contact::getById($notification->actorId); } $body = ''; - if ($Notification->targetUriId) { - $post = Post::selectFirst([], ['uri-id' => $Notification->targetUriId, 'uid' => [0, $Notification->uid]]); + if ($notification->targetUriId) { + $post = Post::selectFirst([], ['uri-id' => $notification->targetUriId, 'uid' => [0, $notification->uid]]); if (!empty($post['body'])) { $body = BBCode::toPlaintext($post['body'], false); - $body = Plaintext::shorten($body, 160, $Notification->uid); + $body = Plaintext::shorten($body, 160, $notification->uid); } } - $message = DI::notificationFactory()->getMessageFromNotification($Notification, DI::baseUrl(), $l10n); - $title = $message['plain'] ?: ''; + $message = DI::notificationFactory()->getMessageFromNotification($notification); + $title = $message['plain'] ?? ''; $push = Subscription::create([ 'contentEncoding' => 'aesgcm', @@ -98,7 +105,7 @@ class PushSubscription 'access_token' => $application_token['access_token'], 'preferred_locale' => $user['language'], 'notification_id' => $nid, - 'notification_type' => \Friendica\Factory\Api\Mastodon\Notification::getType($Notification), + 'notification_type' => NotificationFactory::getType($notification), 'icon' => $actor['thumb'] ?? '', 'title' => $title ?: $l10n->t('Notification from Friendica'), 'body' => $body ?: $l10n->t('Empty Post'),