mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 00:15:46 +01:00
Fix space-before-function-paren linter rule
This commit is contained in:
@@ -9,42 +9,42 @@ var groups = require('../groups');
|
||||
var plugins = require('../plugins');
|
||||
var batch = require('../batch');
|
||||
|
||||
module.exports = function(User) {
|
||||
module.exports = function (User) {
|
||||
|
||||
User.delete = function(callerUid, uid, callback) {
|
||||
User.delete = function (callerUid, uid, callback) {
|
||||
if (!parseInt(uid, 10)) {
|
||||
return callback(new Error('[[error:invalid-uid]]'));
|
||||
}
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
function (next) {
|
||||
deletePosts(callerUid, uid, next);
|
||||
},
|
||||
function(next) {
|
||||
function (next) {
|
||||
deleteTopics(callerUid, uid, next);
|
||||
},
|
||||
function(next) {
|
||||
function (next) {
|
||||
User.deleteAccount(uid, next);
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
function deletePosts(callerUid, uid, callback) {
|
||||
batch.processSortedSet('uid:' + uid + ':posts', function(ids, next) {
|
||||
async.eachSeries(ids, function(pid, next) {
|
||||
batch.processSortedSet('uid:' + uid + ':posts', function (ids, next) {
|
||||
async.eachSeries(ids, function (pid, next) {
|
||||
posts.purge(pid, callerUid, next);
|
||||
}, next);
|
||||
}, {alwaysStartAt: 0}, callback);
|
||||
}
|
||||
|
||||
function deleteTopics(callerUid, uid, callback) {
|
||||
batch.processSortedSet('uid:' + uid + ':topics', function(ids, next) {
|
||||
async.eachSeries(ids, function(tid, next) {
|
||||
batch.processSortedSet('uid:' + uid + ':topics', function (ids, next) {
|
||||
async.eachSeries(ids, function (tid, next) {
|
||||
topics.purge(tid, callerUid, next);
|
||||
}, next);
|
||||
}, {alwaysStartAt: 0}, callback);
|
||||
}
|
||||
|
||||
User.deleteAccount = function(uid, callback) {
|
||||
User.deleteAccount = function (uid, callback) {
|
||||
var userData;
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
@@ -65,19 +65,19 @@ module.exports = function(User) {
|
||||
},
|
||||
function (next) {
|
||||
async.parallel([
|
||||
function(next) {
|
||||
function (next) {
|
||||
db.sortedSetRemove('username:uid', userData.username, next);
|
||||
},
|
||||
function(next) {
|
||||
function (next) {
|
||||
db.sortedSetRemove('username:sorted', userData.username.toLowerCase() + ':' + uid, next);
|
||||
},
|
||||
function(next) {
|
||||
function (next) {
|
||||
db.sortedSetRemove('userslug:uid', userData.userslug, next);
|
||||
},
|
||||
function(next) {
|
||||
function (next) {
|
||||
db.sortedSetRemove('fullname:uid', userData.fullname, next);
|
||||
},
|
||||
function(next) {
|
||||
function (next) {
|
||||
if (userData.email) {
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetRemove, 'email:uid', userData.email.toLowerCase()),
|
||||
@@ -87,7 +87,7 @@ module.exports = function(User) {
|
||||
next();
|
||||
}
|
||||
},
|
||||
function(next) {
|
||||
function (next) {
|
||||
db.sortedSetsRemove([
|
||||
'users:joindate',
|
||||
'users:postcount',
|
||||
@@ -100,10 +100,10 @@ module.exports = function(User) {
|
||||
'digest:month:uids'
|
||||
], uid, next);
|
||||
},
|
||||
function(next) {
|
||||
function (next) {
|
||||
db.decrObjectField('global', 'userCount', next);
|
||||
},
|
||||
function(next) {
|
||||
function (next) {
|
||||
var keys = [
|
||||
'uid:' + uid + ':notifications:read',
|
||||
'uid:' + uid + ':notifications:unread',
|
||||
@@ -120,13 +120,13 @@ module.exports = function(User) {
|
||||
];
|
||||
db.deleteAll(keys, next);
|
||||
},
|
||||
function(next) {
|
||||
function (next) {
|
||||
deleteUserIps(uid, next);
|
||||
},
|
||||
function(next) {
|
||||
function (next) {
|
||||
deleteUserFromFollowers(uid, next);
|
||||
},
|
||||
function(next) {
|
||||
function (next) {
|
||||
groups.leaveAllGroups(uid, next);
|
||||
}
|
||||
], next);
|
||||
@@ -146,15 +146,15 @@ module.exports = function(User) {
|
||||
}, next);
|
||||
},
|
||||
function (pids, next) {
|
||||
pids = pids.upvotedPids.concat(pids.downvotedPids).filter(function(pid, index, array) {
|
||||
pids = pids.upvotedPids.concat(pids.downvotedPids).filter(function (pid, index, array) {
|
||||
return pid && array.indexOf(pid) === index;
|
||||
});
|
||||
|
||||
async.eachSeries(pids, function(pid, next) {
|
||||
async.eachSeries(pids, function (pid, next) {
|
||||
posts.unvote(pid, uid, next);
|
||||
}, next);
|
||||
}
|
||||
], function(err) {
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
@@ -165,10 +165,10 @@ module.exports = function(User) {
|
||||
db.getSortedSetRange('uid:' + uid + ':chat:rooms', 0, -1, next);
|
||||
},
|
||||
function (roomIds, next) {
|
||||
var userKeys = roomIds.map(function(roomId) {
|
||||
var userKeys = roomIds.map(function (roomId) {
|
||||
return 'uid:' + uid + ':chat:room:' + roomId + ':mids';
|
||||
});
|
||||
var roomKeys = roomIds.map(function(roomId) {
|
||||
var roomKeys = roomIds.map(function (roomId) {
|
||||
return 'chat:room:' + roomId + ':uids';
|
||||
});
|
||||
|
||||
@@ -177,7 +177,7 @@ module.exports = function(User) {
|
||||
async.apply(db.deleteAll, userKeys)
|
||||
], next);
|
||||
}
|
||||
], function(err) {
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
@@ -188,7 +188,7 @@ module.exports = function(User) {
|
||||
db.getSortedSetRange('uid:' + uid + ':ip', 0, -1, next);
|
||||
},
|
||||
function (ips, next) {
|
||||
var keys = ips.map(function(ip) {
|
||||
var keys = ips.map(function (ip) {
|
||||
return 'ip:' + ip + ':uid';
|
||||
});
|
||||
db.sortedSetsRemove(keys, uid, next);
|
||||
@@ -203,10 +203,10 @@ module.exports = function(User) {
|
||||
async.parallel({
|
||||
followers: async.apply(db.getSortedSetRange, 'followers:' + uid, 0, -1),
|
||||
following: async.apply(db.getSortedSetRange, 'following:' + uid, 0, -1)
|
||||
}, function(err, results) {
|
||||
}, function (err, results) {
|
||||
function updateCount(uids, name, fieldName, next) {
|
||||
async.each(uids, function(uid, next) {
|
||||
db.sortedSetCard(name + uid, function(err, count) {
|
||||
async.each(uids, function (uid, next) {
|
||||
db.sortedSetCard(name + uid, function (err, count) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
@@ -220,11 +220,11 @@ module.exports = function(User) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
var followingSets = results.followers.map(function(uid) {
|
||||
var followingSets = results.followers.map(function (uid) {
|
||||
return 'following:' + uid;
|
||||
});
|
||||
|
||||
var followerSets = results.following.map(function(uid) {
|
||||
var followerSets = results.following.map(function (uid) {
|
||||
return 'followers:' + uid;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user