diff --git a/web_notify/models/res_users.py b/web_notify/models/res_users.py index eca87abc6e56..2b82fd21d62b 100644 --- a/web_notify/models/res_users.py +++ b/web_notify/models/res_users.py @@ -49,10 +49,13 @@ def notify_success( sticky=False, target=None, action=None, + html=False, params=None, ): title = title or _("Success") - self._notify_channel(SUCCESS, message, title, sticky, target, action, params) + self._notify_channel( + SUCCESS, message, title, sticky, target, html, action, params + ) def notify_danger( self, @@ -60,11 +63,14 @@ def notify_danger( title=None, sticky=False, target=None, + html=False, action=None, params=None, ): title = title or _("Danger") - self._notify_channel(DANGER, message, title, sticky, target, action, params) + self._notify_channel( + DANGER, message, title, sticky, target, html, action, params + ) def notify_warning( self, @@ -72,11 +78,14 @@ def notify_warning( title=None, sticky=False, target=None, + html=False, action=None, params=None, ): title = title or _("Warning") - self._notify_channel(WARNING, message, title, sticky, target, action, params) + self._notify_channel( + WARNING, message, title, sticky, target, html, action, params + ) def notify_info( self, @@ -84,11 +93,12 @@ def notify_info( title=None, sticky=False, target=None, + html=False, action=None, params=None, ): title = title or _("Information") - self._notify_channel(INFO, message, title, sticky, target, action, params) + self._notify_channel(INFO, message, title, sticky, target, html, action, params) def notify_default( self, @@ -96,11 +106,14 @@ def notify_default( title=None, sticky=False, target=None, + html=False, action=None, params=None, ): title = title or _("Default") - self._notify_channel(DEFAULT, message, title, sticky, target, action, params) + self._notify_channel( + DEFAULT, message, title, sticky, target, html, action, params + ) def _notify_channel( self, @@ -109,6 +122,7 @@ def _notify_channel( title=None, sticky=False, target=None, + html=False, action=None, params=None, ): @@ -127,6 +141,7 @@ def _notify_channel( "message": message, "title": title, "sticky": sticky, + "html": html, "action": action, "params": dict(params or []), } diff --git a/web_notify/static/src/js/services/notification_services.esm.js b/web_notify/static/src/js/services/notification_services.esm.js index 1ac2f71d69c1..4daabd3844e9 100644 --- a/web_notify/static/src/js/services/notification_services.esm.js +++ b/web_notify/static/src/js/services/notification_services.esm.js @@ -29,6 +29,7 @@ export const webNotificationService = { type: notification.type, sticky: notification.sticky, className: notification.className, + messageIsHtml: notification.html, buttons: buttons.map((button) => { const onClick = button.onClick; button.onClick = async () => { diff --git a/web_notify/tests/test_res_users.py b/web_notify/tests/test_res_users.py index ae7deca1161e..e146c5ffa41d 100644 --- a/web_notify/tests/test_res_users.py +++ b/web_notify/tests/test_res_users.py @@ -18,6 +18,7 @@ def test_notify_success(self): "message": "message", "title": "title", "sticky": True, + "html": False, "action": None, "params": {}, } @@ -37,6 +38,7 @@ def test_notify_danger(self): "message": "message", "title": "title", "sticky": True, + "html": False, "action": None, "params": {}, } @@ -56,6 +58,7 @@ def test_notify_warning(self): "message": "message", "title": "title", "sticky": True, + "html": False, "action": None, "params": {}, } @@ -75,6 +78,7 @@ def test_notify_info(self): "message": "message", "title": "title", "sticky": True, + "html": False, "action": None, "params": {}, } @@ -94,6 +98,7 @@ def test_notify_default(self): "message": "message", "title": "title", "sticky": True, + "html": False, "action": None, "params": {}, } diff --git a/web_notify_channel_message/models/res_users.py b/web_notify_channel_message/models/res_users.py index 570af514ef31..a3c7162418cf 100644 --- a/web_notify_channel_message/models/res_users.py +++ b/web_notify_channel_message/models/res_users.py @@ -11,6 +11,7 @@ def _notify_channel( title=None, sticky=False, target=None, + html=False, action=None, params=None, ): @@ -21,6 +22,7 @@ def _notify_channel( title=title, sticky=sticky, target=target, + html=html, action=action, params=params, ) @@ -30,6 +32,7 @@ def _notify_channel( title=title, sticky=sticky, target=target, + html=html, action=action, params=params, )