Skip to content

Commit 635f359

Browse files
committed
[FIX] mail: adjust condition to use proper model for user preferences
Before this commit: The isInbox condition was always evaluated as false because it incorrectly checked the user's notification preference in the wrong model. This caused users to receive two push notifications for the same message. After this commit: The isInbox condition now checks the user model for notification preferences, ensuring the correct behavior. closes odoo#233289 X-original-commit: 6e27555 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
1 parent 994b0fa commit 635f359

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

addons/mail/static/src/core/common/store_service.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,9 @@ export class Store extends BaseStore {
426426
// Prevent duplicate inbox push notifications since they're already handled by
427427
// `mail.message/inbox` bus notifications, and the `modelsHandleByPush` heuristic
428428
// in `out_of_focus_service.js` isn't reliable enough to detect these cases.
429-
const isInbox = this.store.self.notification_preference === "inbox" && model !== "discuss.channel";
429+
const isInbox =
430+
this.store.self.main_user_id?.notification_type === "inbox" &&
431+
model !== "discuss.channel";
430432
if ((isTabFocused && thread?.isDisplayed) || isInbox) {
431433
navigator.serviceWorker.controller?.postMessage({
432434
type: "notification-display-response",

0 commit comments

Comments
 (0)