[FIX] mail: remove return in handle notification loop

Before this commit, some notifications handler were using `return`.
The issue is that this will exit the notification processing loop
preventing further notifications to be processed. In practice, this
scenario is limited since notifications come by small batches but
it could be an issue.

closes odoo/odoo#128606

X-original-commit: e8fbc26716917b1066b9002010662d41aaeacbf0
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
tsm-odoo
2023-07-15 13:06:07 +02:00
parent 87f0222aee
commit 7d180a0bc0
@@ -183,7 +183,7 @@ export class Messaging {
// "discuss.channel/leave" and the
// "discuss.channel/new_message" notifications come from
// the bus as a batch.
return;
break;
}
this._handleNotificationNewMessage(notif);
break;
@@ -375,28 +375,29 @@ export class Messaging {
const { channel_id, last_message_id, partner_id } = notif.payload;
const channel =
this.store.threads[createLocalId("discuss.channel", channel_id)];
if (!channel) {
return;
}
const seenInfo = channel.seenInfos.find(
(seenInfo) => seenInfo.partner.id === partner_id
);
if (seenInfo) {
seenInfo.lastFetchedMessage = { id: last_message_id };
if (channel) {
const seenInfo = channel.seenInfos.find(
(seenInfo) => seenInfo.partner.id === partner_id
);
if (seenInfo) {
seenInfo.lastFetchedMessage = { id: last_message_id };
}
}
break;
}
case "discuss.channel/unpin": {
const thread =
this.store.threads[createLocalId("discuss.channel", notif.payload.id)];
if (!thread) {
return;
if (thread) {
thread.is_pinned = false;
this.notificationService.add(
sprintf(
_t("You unpinned your conversation with %s"),
thread.displayName
),
{ type: "info" }
);
}
thread.is_pinned = false;
this.notificationService.add(
sprintf(_t("You unpinned your conversation with %s"), thread.displayName),
{ type: "info" }
);
break;
}
case "mail.message/notification_update":
@@ -425,10 +426,9 @@ export class Messaging {
});
}
const attachment = this.store.attachments[attachmentId];
if (!attachment) {
return;
if (attachment) {
this.attachmentService.remove(attachment);
}
this.attachmentService.remove(attachment);
}
break;
}