The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/utils/lib/getDefaultSubscriptionPref.js

31 lines
894 B

export const getDefaultSubscriptionPref = (userPref) => {
const subscription = {};
const {
desktopNotifications,
mobileNotifications,
emailNotificationMode,
highlights,
} = (userPref.settings && userPref.settings.preferences) || {};
if (Array.isArray(highlights) && highlights.length) {
subscription.userHighlights = highlights;
}
if (desktopNotifications && desktopNotifications !== 'default') {
subscription.desktopNotifications = desktopNotifications;
subscription.desktopPrefOrigin = 'user';
}
if (mobileNotifications && mobileNotifications !== 'default') {
subscription.mobilePushNotifications = mobileNotifications;
subscription.mobilePrefOrigin = 'user';
}
if (emailNotificationMode && emailNotificationMode !== 'default') {
subscription.emailNotifications = emailNotificationMode;
subscription.emailPrefOrigin = 'user';
}
return subscription;
};