]> git.mxchange.org Git - friendica.git/blobdiff - include/enotify.php
Merge pull request #8895 from annando/performance
[friendica.git] / include / enotify.php
index ae2e2e7fefba2526e381350dfd9b00861f5f8cf2..6b3171dda6d6cd2102ae9035cbd746201602a79a 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);