[FIX] mail: ignore broadcast notifications targeting another user

This is typically not the case in production code, but it doesn't hurt to be
safe. The main reason for the change however is that it causes issues in tests
due to the easiest way to simulate notifications being to send them directly on
the bus which is "listened to" no matter the target user.

PR: #56243
Part of task-2323670

X-original-commit: 62e1e7fe39a7bed6ce70466a0aec645c7a0f299d
This commit is contained in:
Sébastien Theys
2020-08-24 13:47:00 +00:00
parent 4ab5c2a48b
commit 7bec33f578
2 changed files with 5 additions and 1 deletions
@@ -77,6 +77,10 @@ function factory(dependencies) {
channelId: id,
}, data));
case 'res.partner':
if (id !== this.env.messaging.currentPartner.id) {
// ignore broadcast to other partners
return;
}
return this._handleNotificationPartner(Object.assign({}, data));
default:
console.warn(`mail.messaging_notification_handler: Unhandled notification "${model}"`);
@@ -863,7 +863,7 @@ MockServer.include({
message_ids: messageIDs,
type: "deletion",
};
const metaData = [dbName, 'res.partner'];
const metaData = [dbName, 'res.partner', this.currentPartnerId];
const notification = [metaData, notifData];
this._widget.call('bus_service', 'trigger', 'notification', [notification]);
} else if (decision === 'accept') {