Fix fatal error in notifications

This commit is contained in:
Michael 2024-07-11 15:34:36 +00:00
parent d63edf5dfa
commit f9a3b67318

View file

@ -77,7 +77,7 @@ class Notify extends BaseEntity
protected $verb; protected $verb;
/** @var string */ /** @var string */
protected $otype; protected $otype;
/** @var string */ /** @var string|null */
protected $name_cache; protected $name_cache;
/** @var string|null */ /** @var string|null */
protected $msg_cache; protected $msg_cache;
@ -88,7 +88,7 @@ class Notify extends BaseEntity
/** @var int|null */ /** @var int|null */
protected $id; 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->type = $type;
$this->name = $name; $this->name = $name;
@ -118,7 +118,7 @@ class Notify extends BaseEntity
public function updateMsgFromPreamble($epreamble) public function updateMsgFromPreamble($epreamble)
{ {
$this->msg = Renderer::replaceMacros($epreamble, ['$itemlink' => $this->link->__toString()]); $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));
} }
/** /**