This commit is contained in:
syuilo 2019-02-22 14:02:56 +09:00
parent e8d2959717
commit be3298639d
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
27 changed files with 98 additions and 173 deletions

View file

@ -5,6 +5,7 @@ import User, { pack as packUser } from '../../../../../models/user';
import { publishUserListStream } from '../../../../../services/stream';
import define from '../../../define';
import { ApiError } from '../../../error';
import { getUser } from '../../../common/getters';
export const meta = {
desc: {
@ -59,14 +60,11 @@ export default define(meta, async (ps, me) => {
}
// Fetch the user
const user = await User.findOne({
_id: ps.userId
const user = await getUser(ps.userId).catch(e => {
if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
throw e;
});
if (user == null) {
throw new ApiError(meta.errors.noSuchUser);
}
// Pull the user
await UserList.update({ _id: userList._id }, {
$pull: {