]> git.mxchange.org Git - friendica.git/blobdiff - include/enotify.php
Merge pull request #1 from friendica/develop
[friendica.git] / include / enotify.php
index ae2e2e7fefba2526e381350dfd9b00861f5f8cf2..732c1d7b43c18e401f5cb31c494b3689780ec2a6 100644 (file)
@@ -465,7 +465,7 @@ function notification($params)
        if ($show_in_notification_page) {
                $notification = DI::notify()->insert([
                        'name'          => $params['source_name'] ?? '',
-                       'name_cache'    => substr(strip_tags(BBCode::convert($params['source_name'] ?? '')), 0, 255),
+                       'name_cache'    => substr(strip_tags(BBCode::convert($params['source_name'])), 0, 255),
                        'url'           => $params['source_link'] ?? '',
                        'photo'         => $params['source_photo'] ?? '',
                        'link'          => $itemlink ?? '',
@@ -479,6 +479,11 @@ function notification($params)
                        'otype'         => $params['otype'] ?? '',
                ]);
 
+               // Notification insertion can be intercepted by an addon registering the 'enotify_store' hook
+               if (!$notification) {
+                       return false;
+               }
+
                $notification->msg = Renderer::replaceMacros($epreamble, ['$itemlink' => $notification->link]);
 
                DI::notify()->update($notification);
@@ -592,7 +597,7 @@ function check_item_notification($itemid, $uid, $notification_type) {
        $fields = ['id', 'uri-id', 'mention', 'parent', 'parent-uri-id', 'title', 'body',
                'author-link', 'author-name', 'author-avatar', 'author-id',
                'guid', 'parent-uri', 'uri', 'contact-id', 'network'];
-       $condition = ['id' => $itemid, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'deleted' => false];
+       $condition = ['id' => $itemid, 'deleted' => false];
        $item = Item::selectFirstForUser($uid, $fields, $condition);
        if (!DBA::isResult($item)) {
                return false;