]> git.mxchange.org Git - friendica.git/commitdiff
Fix fatal error in notifications
authorMichael <heluecht@pirati.ca>
Thu, 11 Jul 2024 15:34:36 +0000 (15:34 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 11 Jul 2024 15:34:36 +0000 (15:34 +0000)
src/Navigation/Notifications/Entity/Notify.php

index 635620ee8fc030ebc6c465ac74b17889af0dc830..f0eec9052680e4497dd82c94edcab378f780251a 100644 (file)
@@ -77,7 +77,7 @@ class Notify extends BaseEntity
        protected $verb;
        /** @var string */
        protected $otype;
-       /** @var string */
+       /** @var string|null */
        protected $name_cache;
        /** @var string|null */
        protected $msg_cache;
@@ -88,7 +88,7 @@ class Notify extends BaseEntity
        /** @var int|null */
        protected $id;
 
-       public function __construct(int $type, string $name, UriInterface $url, UriInterface $photo, DateTime $date, int $uid, UriInterface $link, bool $seen, string $verb, string $otype, string $name_cache, string $msg = null, string $msg_cache = null, int $itemId = null, int $uriId = null, int $parent = null, ?int $parentUriId = null, ?int $id = null)
+       public function __construct(int $type, string $name, UriInterface $url, UriInterface $photo, DateTime $date, int $uid, UriInterface $link, bool $seen, string $verb, string $otype, string $name_cache = null, string $msg = null, string $msg_cache = null, int $itemId = null, int $uriId = null, int $parent = null, ?int $parentUriId = null, ?int $id = null)
        {
                $this->type        = $type;
                $this->name        = $name;
@@ -118,7 +118,7 @@ class Notify extends BaseEntity
        public function updateMsgFromPreamble($epreamble)
        {
                $this->msg       = Renderer::replaceMacros($epreamble, ['$itemlink' => $this->link->__toString()]);
-               $this->msg_cache = self::formatMessage($this->name_cache, BBCode::toPlaintext($this->msg, false));
+               $this->msg_cache = self::formatMessage($this->name_cache ?? $this->name, BBCode::toPlaintext($this->msg, false));
        }
 
        /**