Refactor
This commit is contained in:
@@ -7,6 +7,7 @@ import { publishMainStream, publishReversiStream } from '../../../../../services
|
||||
import { eighteight } from '../../../../../games/reversi/maps';
|
||||
import define from '../../../define';
|
||||
import { ApiError } from '../../../error';
|
||||
import { getUser } from '../../../common/getters';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: true,
|
||||
@@ -85,18 +86,11 @@ export default define(meta, async (ps, user) => {
|
||||
return await packGame(game, user);
|
||||
} else {
|
||||
// Fetch child
|
||||
const child = await User.findOne({
|
||||
_id: ps.userId
|
||||
}, {
|
||||
fields: {
|
||||
_id: true
|
||||
}
|
||||
const child = await getUser(ps.userId).catch(e => {
|
||||
if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
|
||||
throw e;
|
||||
});
|
||||
|
||||
if (child === null) {
|
||||
throw new ApiError(meta.errors.noSuchUser);
|
||||
}
|
||||
|
||||
// 以前のセッションはすべて削除しておく
|
||||
await Matching.remove({
|
||||
parentId: user._id
|
||||
|
Reference in New Issue
Block a user