Skip to content
Snippets Groups Projects
Commit eb6e66e0 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

re #4705

parent 09bfe13a
No related branches found
No related tags found
1 merge request!3500fix parameters html_id and avatar for PersonalNotifications::add(), fixes #4705
Pipeline #27718 passed
...@@ -94,14 +94,14 @@ class PersonalNotifications extends SimpleORMap ...@@ -94,14 +94,14 @@ class PersonalNotifications extends SimpleORMap
* @param array|string $user_ids : array of user_ids or a single md5-user_id * @param array|string $user_ids : array of user_ids or a single md5-user_id
* @param string $url : URL of the point of interest of the notification * @param string $url : URL of the point of interest of the notification
* @param string $text : a displayed text that describes the notification * @param string $text : a displayed text that describes the notification
* @param string $html_id : id in the html-document. If user reaches * @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 * this html-element the notification will be marked as read, so the user
* does not need to handle the information twice. Optional. * 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 * image for the notification. Best size: 40px x 40px
* @return boolean : true on success * @return boolean : true on success
*/ */
public static function add($user_ids, $url, $text, $html_id = '', $avatar = '', $dialog = false) public static function add($user_ids, $url, $text, $html_id = null, $avatar = null, $dialog = false)
{ {
if (!is_array($user_ids)) { if (!is_array($user_ids)) {
$user_ids = [$user_ids]; $user_ids = [$user_ids];
...@@ -114,10 +114,10 @@ class PersonalNotifications extends SimpleORMap ...@@ -114,10 +114,10 @@ class PersonalNotifications extends SimpleORMap
} }
$notification = new self(); $notification = new self();
$notification['html_id'] = $html_id; $notification['html_id'] = $html_id ?? '';
$notification['url'] = $url; $notification['url'] = $url;
$notification['text'] = $text; $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['dialog'] = $dialog ? 1 : 0;
$notification->store(); $notification->store();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment