]> git.mxchange.org Git - friendica.git/blobdiff - include/enotify.php
Merge pull request #8895 from annando/performance
[friendica.git] / include / enotify.php
index 81b491ade504562ff5416d2f95ccc0940dede65b..6b3171dda6d6cd2102ae9035cbd746201602a79a 100644 (file)
@@ -465,20 +465,25 @@ 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 ?? '',
                        'uid'           => $params['uid'] ?? 0,
-                       'iid'           => $item_id ?? 0,
-                       'uri-id'        => $uri_id ?? 0,
-                       'parent'        => $parent_id ?? 0,
-                       'parent-uri-id' => $parent_uri_id ?? 0,                 
+                       'iid'           => $item_id,
+                       'uri-id'        => $uri_id,
+                       'parent'        => $parent_id,
+                       'parent-uri-id' => $parent_uri_id,
                        'type'          => $params['type'] ?? '',
                        'verb'          => $params['verb'] ?? '',
                        '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);