mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-11 21:29:08 +09:00
wip
This commit is contained in:
parent
53415e9ba4
commit
b846eb8afe
@ -11,3 +11,30 @@ export interface IMute {
|
||||
muterId: mongo.ObjectID;
|
||||
muteeId: mongo.ObjectID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Muteを物理削除します
|
||||
*/
|
||||
export async function deleteMute(mute: string | mongo.ObjectID | IMute) {
|
||||
let m: IMute;
|
||||
|
||||
// Populate
|
||||
if (mongo.ObjectID.prototype.isPrototypeOf(mute)) {
|
||||
m = await Mute.findOne({
|
||||
_id: mute
|
||||
});
|
||||
} else if (typeof mute === 'string') {
|
||||
m = await Mute.findOne({
|
||||
_id: new mongo.ObjectID(mute)
|
||||
});
|
||||
} else {
|
||||
m = mute as IMute;
|
||||
}
|
||||
|
||||
if (m == null) return;
|
||||
|
||||
// このMuteを削除
|
||||
await Mute.remove({
|
||||
_id: m._id
|
||||
});
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import rap from '@prezzemolo/rap';
|
||||
import db from '../db/mongodb';
|
||||
import Note, { INote, pack as packNote, deleteNote } from './note';
|
||||
import Following from './following';
|
||||
import Mute from './mute';
|
||||
import Mute, { deleteMute } from './mute';
|
||||
import getFriends from '../server/api/common/get-friends';
|
||||
import config from '../config';
|
||||
import AccessToken, { deleteAccessToken } from './access-token';
|
||||
@ -201,10 +201,24 @@ export async function deleteUser(user: string | mongo.ObjectID | IUser) {
|
||||
await DriveFolder.find({ userId: u._id })
|
||||
).map(x => deleteDriveFolder(x)));
|
||||
|
||||
// このユーザーのMuteをすべて削除
|
||||
await Promise.all((
|
||||
await Mute.find({ muterId: u._id })
|
||||
).map(x => deleteMute(x)));
|
||||
|
||||
// このユーザーへのMuteをすべて削除
|
||||
await Promise.all((
|
||||
await Mute.find({ muteeId: u._id })
|
||||
).map(x => deleteMute(x)));
|
||||
|
||||
// このユーザーのFollowingをすべて削除
|
||||
|
||||
// このユーザーへのFollowingをすべて削除
|
||||
|
||||
// このユーザーのFollowingLogをすべて削除
|
||||
|
||||
// このユーザーのFollowedLogをすべて削除
|
||||
|
||||
// このユーザーを削除
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user