mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 04:11:26 +08:00
24 lines
545 B
JavaScript
24 lines
545 B
JavaScript
const errors = require('../../errors');
|
|
|
|
const { UPDATE_SETTINGS } = require('../../perms/constants');
|
|
|
|
const SettingsService = require('../../services/settings');
|
|
|
|
const update = async (ctx, settings) => SettingsService.update(settings);
|
|
|
|
module.exports = ctx => {
|
|
let mutators = {
|
|
Settings: {
|
|
update: () => Promise.reject(errors.ErrNotAuthorized),
|
|
},
|
|
};
|
|
|
|
if (ctx.user) {
|
|
if (ctx.user.can(UPDATE_SETTINGS)) {
|
|
mutators.Settings.update = (id, settings) => update(ctx, id, settings);
|
|
}
|
|
}
|
|
|
|
return mutators;
|
|
};
|