Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions web_notify/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,58 +49,71 @@ 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,
message="Default message",
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,
message="Default message",
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,
message="Default message",
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,
message="Default message",
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,
Expand All @@ -109,6 +122,7 @@ def _notify_channel(
title=None,
sticky=False,
target=None,
html=False,
action=None,
params=None,
):
Expand All @@ -127,6 +141,7 @@ def _notify_channel(
"message": message,
"title": title,
"sticky": sticky,
"html": html,
"action": action,
"params": dict(params or []),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
5 changes: 5 additions & 0 deletions web_notify/tests/test_res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def test_notify_success(self):
"message": "message",
"title": "title",
"sticky": True,
"html": False,
"action": None,
"params": {},
}
Expand All @@ -37,6 +38,7 @@ def test_notify_danger(self):
"message": "message",
"title": "title",
"sticky": True,
"html": False,
"action": None,
"params": {},
}
Expand All @@ -56,6 +58,7 @@ def test_notify_warning(self):
"message": "message",
"title": "title",
"sticky": True,
"html": False,
"action": None,
"params": {},
}
Expand All @@ -75,6 +78,7 @@ def test_notify_info(self):
"message": "message",
"title": "title",
"sticky": True,
"html": False,
"action": None,
"params": {},
}
Expand All @@ -94,6 +98,7 @@ def test_notify_default(self):
"message": "message",
"title": "title",
"sticky": True,
"html": False,
"action": None,
"params": {},
}
Expand Down
3 changes: 3 additions & 0 deletions web_notify_channel_message/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def _notify_channel(
title=None,
sticky=False,
target=None,
html=False,
action=None,
params=None,
):
Expand All @@ -21,6 +22,7 @@ def _notify_channel(
title=title,
sticky=sticky,
target=target,
html=html,
action=action,
params=params,
)
Expand All @@ -30,6 +32,7 @@ def _notify_channel(
title=title,
sticky=sticky,
target=target,
html=html,
action=action,
params=params,
)