]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Subscription.php
Merge pull request #10619 from nupplaphil/task/guzzlehttp
[friendica.git] / src / Model / Subscription.php
index 5fb88911ac4dc903a28da7f03652ace6f07a19bb..59e71307f5ffb4092bf67fbe132ec823e65f63bc 100644 (file)
  *
  */
 
- /**
-  * @see https://github.com/web-push-libs/web-push-php
-  * Possibly we should simply use this.
-  */
-
 namespace Friendica\Model;
 
 use Friendica\Core\Logger;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
 use Friendica\DI;
-use Friendica\Util\Crypto;
 use Minishlink\WebPush\VAPID;
 
 class Subscription
@@ -148,6 +142,21 @@ class Subscription
                $notification = DBA::selectFirst('notification', [], ['id' => $nid]);
 
                $type = Notification::getType($notification);
+
+               $desktop_notification = !in_array($type, ['reblog', 'favourite']);
+
+               if (DI::pConfig()->get($notification['uid'], 'system', 'notify_like') && ($type == 'favourite')) {
+                       $desktop_notification = true;
+               }
+
+               if (DI::pConfig()->get($notification['uid'], 'system', 'notify_announce') && ($type == 'reblog')) {
+                       $desktop_notification = true;
+               }
+
+               if ($desktop_notification) {
+                       notification_from_array($notification);
+               }
+
                if (empty($type)) {
                        return;
                }