mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
banUsers and moderate separate streams, not found assets etc
This commit is contained in:
@@ -2,6 +2,7 @@ const _ = require('lodash');
|
||||
|
||||
const Comment = require('./comment');
|
||||
const Action = require('./action');
|
||||
const User = require('./user');
|
||||
|
||||
module.exports = (context) => {
|
||||
|
||||
@@ -9,6 +10,7 @@ module.exports = (context) => {
|
||||
return _.merge(...[
|
||||
Comment,
|
||||
Action,
|
||||
User,
|
||||
].map((mutators) => {
|
||||
|
||||
// Each set of mutators is a function which takes the context.
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
const UsersService = require('../../services/users');
|
||||
|
||||
const setUserStatus = ({user}, {id, status}) => {
|
||||
console.log('------as-d-asd-a-sads-a-sad-dsa-----');
|
||||
console.log('user', user);
|
||||
console.log('id', id);
|
||||
console.log('status', status);
|
||||
|
||||
return UsersService.setStatus(id, status)
|
||||
.then((user) => {
|
||||
console.log('result', user);
|
||||
return user;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = (context) => {
|
||||
|
||||
// TODO: refactor to something that'll return an error in the event an attempt
|
||||
// is made to mutate state while not logged in. There's got to be a better way
|
||||
// to do this.
|
||||
if (context.user && context.user.can('mutation:setUserStatus')) {
|
||||
return {
|
||||
User: {
|
||||
setUserStatus: (action) => setUserStatus(context, action)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
User: {
|
||||
setUserStatus: () => {},
|
||||
}
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user