From 12530675e85e7ffdbee0c47d21041a9d9ab64818 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Wed, 16 Oct 2024 13:04:22 +0000
Subject: [PATCH] fix parameters html_id and avatar for
 PersonalNotifications::add(), fixes #4705

Closes #4705

Merge request studip/studip!3500
---
 lib/models/PersonalNotifications.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/models/PersonalNotifications.php b/lib/models/PersonalNotifications.php
index 12d9c1b14c6..c4230b8dd64 100644
--- a/lib/models/PersonalNotifications.php
+++ b/lib/models/PersonalNotifications.php
@@ -97,7 +97,7 @@ class PersonalNotifications extends SimpleORMap
      * @param null|string $html_id : id in the html-document. If user reaches
      *   this html-element the notification will be marked as read, so the user
      *   does not need to handle the information twice. Optional. Default: null
-     * @param Icon|string $avatar : either an Icon or a URL of an
+     * @param null|Icon|string $avatar : either an Icon or a URL of an
      *   image for the notification. Best size: 40px x 40px
      * @return boolean : true on success
      */
@@ -114,10 +114,10 @@ class PersonalNotifications extends SimpleORMap
         }
 
         $notification = new self();
-        $notification['html_id'] = $html_id;
+        $notification['html_id'] = $html_id ?? '';
         $notification['url']     = $url;
         $notification['text']    = $text;
-        $notification['avatar']  = $avatar instanceof Icon ? $avatar->asImagePath(40) : $avatar;
+        $notification['avatar']  = $avatar instanceof Icon ? $avatar->asImagePath() : $avatar ?? '';
         $notification['dialog']  = $dialog ? 1 : 0;
         $notification->store();
 
-- 
GitLab