From a015524cb5874dd33c884588dd2e35faa63ca08f Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Thu, 12 Apr 2018 07:13:15 +0900 Subject: wip --- src/models/user.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/models/user.ts') diff --git a/src/models/user.ts b/src/models/user.ts index ff1c11e76c..cbc445256b 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -3,7 +3,7 @@ import deepcopy = require('deepcopy'); import rap from '@prezzemolo/rap'; import db from '../db/mongodb'; import Note, { INote, pack as packNote, deleteNote } from './note'; -import Following from './following'; +import Following, { deleteFollowing } from './following'; import Mute, { deleteMute } from './mute'; import getFriends from '../server/api/common/get-friends'; import config from '../config'; @@ -212,8 +212,14 @@ export async function deleteUser(user: string | mongo.ObjectID | IUser) { ).map(x => deleteMute(x))); // このユーザーのFollowingをすべて削除 + await Promise.all(( + await Following.find({ followerId: u._id }) + ).map(x => deleteFollowing(x))); // このユーザーへのFollowingをすべて削除 + await Promise.all(( + await Following.find({ followeeId: u._id }) + ).map(x => deleteFollowing(x))); // このユーザーのFollowingLogをすべて削除 -- cgit v1.2.3-freya