Update blue_modules/notifications.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Marcos Rodriguez Vélez 2024-11-13 18:45:08 -04:00 committed by GitHub
parent 43d5a44ad0
commit 8ab9f19b42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -279,9 +279,12 @@ export const configureNotifications = async onProcessNotifications => {
if (notification.data?.data) {
// Validate data before merging
const validData = Object.entries(notification.data.data)
.filter(([_, value]) => value !== null && value !== undefined)
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {});
const validData = {};
for (const [key, value] of Object.entries(notification.data.data)) {
if (value != null) {
validData[key] = value;
}
}
Object.assign(payload, validData);
}
payload.data = undefined;