mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 22:01:13 +08:00
28 lines
787 B
JavaScript
28 lines
787 B
JavaScript
const { get } = require('lodash');
|
|
const { DISABLE_REQUIRE_EMAIL_VERIFICATIONS } = require('./config');
|
|
|
|
module.exports = {
|
|
User: {
|
|
notificationSettings(user, args, { user: currentUser }) {
|
|
if (
|
|
currentUser &&
|
|
(currentUser.id === user.id || currentUser.can('VIEW_USER_STATUS'))
|
|
) {
|
|
return get(user, 'metadata.notifications.settings', {});
|
|
}
|
|
},
|
|
},
|
|
NotificationSettings: {
|
|
digestFrequency: settings => get(settings, 'digestFrequency', 'NONE'),
|
|
},
|
|
RootMutation: {
|
|
async updateNotificationSettings(obj, { input }, { mutators: { User } }) {
|
|
await User.updateNotificationSettings(input);
|
|
},
|
|
},
|
|
Settings: {
|
|
notificationsRequireConfirmation: () =>
|
|
Boolean(!DISABLE_REQUIRE_EMAIL_VERIFICATIONS),
|
|
},
|
|
};
|