details: https://code.tryton.org/tryton/commit/e6effcf7530b
branch: default
user: Cédric Krier <[email protected]>
date: Tue Dec 16 01:10:47 2025 +0100
description:
Replace notify method by binded version in constructor of chat and
notification menu
We need to keep a reference to the binded method registered to be able
to
unregister it.
Closes #14425
diffstat:
sao/src/chat.js | 3 ++-
sao/src/notification.js | 1 +
sao/src/sao.js | 5 ++---
3 files changed, 5 insertions(+), 4 deletions(-)
diffs (47 lines):
diff -r c90d3613f07e -r e6effcf7530b sao/src/chat.js
--- a/sao/src/chat.js Thu Dec 18 21:24:26 2025 +0100
+++ b/sao/src/chat.js Tue Dec 16 01:10:47 2025 +0100
@@ -5,8 +5,9 @@
class _Chat {
constructor(record) {
+ this.notify = this.notify.bind(this);
this.record = record;
- Sao.Bus.register(`chat:${this.record}`, this.notify.bind(this));
+ Sao.Bus.register(`chat:${this.record}`, this.notify);
this.el = this.__build();
}
diff -r c90d3613f07e -r e6effcf7530b sao/src/notification.js
--- a/sao/src/notification.js Thu Dec 18 21:24:26 2025 +0100
+++ b/sao/src/notification.js Tue Dec 16 01:10:47 2025 +0100
@@ -6,6 +6,7 @@
class _NotificationMenu {
constructor() {
+ this.notify = this.notify.bind(this);
this.el = jQuery('<ul/>', {
'class': 'notification-menu dropdown-menu',
'role': 'menu',
diff -r c90d3613f07e -r e6effcf7530b sao/src/sao.js
--- a/sao/src/sao.js Thu Dec 18 21:24:26 2025 +0100
+++ b/sao/src/sao.js Tue Dec 16 01:10:47 2025 +0100
@@ -614,8 +614,7 @@
let user_id =
Sao.Session.current_session.user_id;
Sao.Bus.register(
`notification:${user_id}`,
- Sao.NotificationMenu.notify
- .bind(Sao.NotificationMenu));
+ Sao.NotificationMenu.notify);
Sao.NotificationMenu.count();
Sao.Bus.listen();
@@ -642,7 +641,7 @@
jQuery('#menu').empty();
let user_id = Sao.Session.current_session.user_id;
Sao.Bus.unregister(
- `notification:${user_id}`, Sao.NotificationMenu.update);
+ `notification:${user_id}`, Sao.NotificationMenu.notify);
session.do_logout().always(Sao.login);
Sao.set_title();
});