]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/PushSubscription.php
Merge pull request #12589 from MrPetovan/bug/warnings
[friendica.git] / src / Worker / PushSubscription.php
index 48695bfcd0d52b589b7d58d80ca6c2bd9c2c4875..895a0d0d2d3f45c23dd7aa075e7a468b1b401fdb 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -26,11 +26,11 @@ use Friendica\Content\Text\Plaintext;
 use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 use Friendica\DI;
+use Friendica\Factory\Api\Mastodon\Notification as NotificationFactory;
 use Friendica\Model\Contact;
 use Friendica\Model\Post;
 use Friendica\Model\Subscription as ModelSubscription;
 use Friendica\Model\User;
-use Friendica\Navigation\Notifications;
 use Friendica\Network\HTTPException\NotFoundException;
 use Minishlink\WebPush\WebPush;
 use Minishlink\WebPush\Subscription;
@@ -90,7 +90,7 @@ class PushSubscription
                }
 
                $message = DI::notificationFactory()->getMessageFromNotification($notification);
-               $title = $message['plain'] ?: '';
+               $title = $message['plain'] ?? '';
 
                $push = Subscription::create([
                        'contentEncoding' => 'aesgcm',
@@ -101,12 +101,11 @@ class PushSubscription
                        ],
                ]);
 
-               // @todo Only used for logging?
                $payload = [
                        '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'),