[FIX] mail: indeterministic guest tour
This PR fixes the `19916` issue on the `test_mail_channel_public_page_as_guest` test. The messaging service subscribes to bus notifications before it is fully initialized. This test is composed of two tours. In the first one, the guest joins the channel and receives the "guest has joined the channel" message. Then, the second tour starts and the local storage is cleared. Since the local storage has been cleared, the guest receives this message again, potentially before messaging has been initialized which leads to a `channel_pin` rpc. This RPC fails with `SessionExpired` error and the tour is stuck and eventually, fails. closes odoo/odoo#118000 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
@@ -730,10 +730,12 @@ export const messagingService = {
|
||||
}
|
||||
const messaging = new Messaging(env, services);
|
||||
messaging.initialize();
|
||||
services.bus_service.addEventListener("notification", (notifEvent) => {
|
||||
messaging.handleNotification(notifEvent.detail);
|
||||
messaging.isReady.then(() => {
|
||||
services.bus_service.addEventListener("notification", (notifEvent) => {
|
||||
messaging.handleNotification(notifEvent.detail);
|
||||
});
|
||||
services.bus_service.start();
|
||||
});
|
||||
services.bus_service.start();
|
||||
return messaging;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user