Files
talk/plugins/talk-plugin-notifications/server/resolvers.js
T
Wyatt Johnson 5d1eff0ddb added mutations
2018-02-12 19:02:27 -07:00

20 lines
496 B
JavaScript

const { get } = require('lodash');
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', {});
}
},
},
RootMutation: {
async updateNotificationSettings(obj, { input }, { mutators: { User } }) {
await User.updateNotificationSettings(input);
},
},
};