mirror of
https://github.com/wassname/talk.git
synced 2026-07-16 11:22:16 +08:00
cleanup
This commit is contained in:
+2
-8
@@ -28,7 +28,6 @@ const CommentModel = require('../models/comment');
|
||||
const ActionModel = require('../models/action');
|
||||
const USER_ROLES = require('../models/enum/user_roles');
|
||||
const mongoose = require('../services/mongoose');
|
||||
const databaseVerifications = require('./verifications/database');
|
||||
|
||||
// Register the shutdown criteria.
|
||||
util.onshutdown([() => mongoose.disconnect()]);
|
||||
@@ -65,6 +64,8 @@ async function deleteUser(userID) {
|
||||
|
||||
console.warn("Removing user's actions");
|
||||
|
||||
// FIXME: fix the counts.
|
||||
|
||||
// Remove all the user's actions.
|
||||
await ActionModel.where({ user_id: user.id })
|
||||
.setOptions({ multi: true })
|
||||
@@ -77,13 +78,6 @@ async function deleteUser(userID) {
|
||||
.setOptions({ multi: true })
|
||||
.remove();
|
||||
|
||||
console.warn('Updating the database indexes');
|
||||
|
||||
// Update the counts that might have changed.
|
||||
for (const verification of databaseVerifications) {
|
||||
await verification({ fix: true, limit: Infinity, batch: 1000 });
|
||||
}
|
||||
|
||||
console.warn('Removing the user');
|
||||
|
||||
// Remove the user.
|
||||
|
||||
Reference in New Issue
Block a user