* closes #6738 closes #6290

* fix test, delete keys

* delete all bans on user delete

* fix upgrade script to actually read reason
This commit is contained in:
Barış Soner Uşaklı
2018-09-24 20:20:52 -04:00
committed by GitHub
parent 630873a742
commit 95501e8fee
6 changed files with 165 additions and 49 deletions

View File

@@ -119,6 +119,7 @@ module.exports = function (User) {
'users:postcount',
'users:reputation',
'users:banned',
'users:banned:expire',
'users:online',
'users:notvalidated',
'digest:day:uids',
@@ -149,6 +150,9 @@ module.exports = function (User) {
function (next) {
deleteUserIps(uid, next);
},
function (next) {
deleteBans(uid, next);
},
function (next) {
deleteUserFromFollowers(uid, next);
},
@@ -220,6 +224,20 @@ module.exports = function (User) {
], callback);
}
function deleteBans(uid, callback) {
async.waterfall([
function (next) {
db.getSortedSetRange('uid:' + uid + ':bans:timestamp', 0, -1, next);
},
function (bans, next) {
db.deleteAll(bans, next);
},
function (next) {
db.delete('uid:' + uid + ':bans:timestamp', next);
},
], callback);
}
function deleteUserFromFollowers(uid, callback) {
async.parallel({
followers: async.apply(db.getSortedSetRange, 'followers:' + uid, 0, -1),