Skip to content

Commit

Permalink
Use an array for the avatar string
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Friedman <[email protected]>
  • Loading branch information
iMattPro committed May 17, 2024
1 parent 868fc58 commit 017d517
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions notification/method/webpush.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ protected function clean_expired_subscriptions(array $user_subscription_map, arr
* into https://myboard.url/path/to/avatar=123456789.gif
*
* @param string $avatar
* @return string Absolute path to avatar image
* @return array Absolute path to avatar image in an array with src as its key
*/
protected function prepare_avatar($avatar)
{
Expand All @@ -455,7 +455,7 @@ protected function prepare_avatar($avatar)

$path = !empty($matches[1]) ? end($matches[1]) : $avatar;

return preg_replace('#^' . preg_quote($this->path_helper->get_web_root_path(), '#') . '#', $this->get_board_url(), $path, 1);
return ['src' => preg_replace('#^' . preg_quote($this->path_helper->get_web_root_path(), '#') . '#', $this->get_board_url(), $path, 1)];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion styles/all/template/push_worker.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ self.addEventListener('push', event => {
const options = {
body: responseBody,
data: response,
icon: response.avatar,
icon: response.avatar.src,
};
self.registration.showNotification(response.heading, options);
});
Expand Down

0 comments on commit 017d517

Please sign in to comment.