mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-05 10:05:28 +02:00
ESlint comma-dangle
This commit is contained in:
@@ -52,7 +52,7 @@ module.exports = function (User) {
|
||||
});
|
||||
|
||||
next(null, csvContent);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ module.exports = function (User) {
|
||||
username: userData.username,
|
||||
email: userData.email,
|
||||
ip: userData.ip,
|
||||
hashedPassword: hashedPassword
|
||||
hashedPassword: hashedPassword,
|
||||
};
|
||||
plugins.fireHook('filter:user.addToApprovalQueue', {data: data, userData: userData}, next);
|
||||
},
|
||||
@@ -41,7 +41,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
sendNotificationToAdmins(userData.username, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -52,12 +52,12 @@ module.exports = function (User) {
|
||||
bodyShort: '[[notifications:new_register, ' + username + ']]',
|
||||
nid: 'new_register:' + username,
|
||||
path: '/admin/manage/registration',
|
||||
mergeId: 'new_register'
|
||||
mergeId: 'new_register',
|
||||
}, next);
|
||||
},
|
||||
function (notification, next) {
|
||||
notifications.pushGroup(notification, 'administrators', next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ module.exports = function (User) {
|
||||
username: username,
|
||||
subject: subject,
|
||||
template: 'registration_accepted',
|
||||
uid: uid
|
||||
uid: uid,
|
||||
};
|
||||
|
||||
emailer.send('registration_accepted', uid, data, next);
|
||||
@@ -101,7 +101,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
next(null, uid);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -115,7 +115,7 @@ module.exports = function (User) {
|
||||
async.each(uids, function (uid, next) {
|
||||
notifications.markRead(nid, uid, next);
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -126,14 +126,14 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
markNotificationRead(username, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
function removeFromQueue(username, callback) {
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetRemove, 'registration:queue', username),
|
||||
async.apply(db.delete, 'registration:queue:name:' + username)
|
||||
async.apply(db.delete, 'registration:queue:name:' + username),
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -191,7 +191,7 @@ module.exports = function (User) {
|
||||
'&email=' + encodeURIComponent(user.email) +
|
||||
'&username=' + encodeURIComponent(user.username) +
|
||||
'&f=json',
|
||||
json: true
|
||||
json: true,
|
||||
}, function (err, response, body) {
|
||||
if (err) {
|
||||
return next();
|
||||
@@ -205,7 +205,7 @@ module.exports = function (User) {
|
||||
|
||||
next();
|
||||
});
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
next(err, user);
|
||||
});
|
||||
@@ -216,7 +216,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (results, next) {
|
||||
next(null, results.users);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ module.exports = function (User) {
|
||||
events.log({
|
||||
type: 'account-locked',
|
||||
uid: uid,
|
||||
ip: ip
|
||||
ip: ip,
|
||||
});
|
||||
next(new Error('[[error:account-locked]]'));
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -51,7 +51,7 @@ module.exports = function (User) {
|
||||
User.auth.resetLockout = function (uid, callback) {
|
||||
async.parallel([
|
||||
async.apply(db.delete, 'loginAttempts:' + uid),
|
||||
async.apply(db.delete, 'lockout:' + uid)
|
||||
async.apply(db.delete, 'lockout:' + uid),
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -98,7 +98,7 @@ module.exports = function (User) {
|
||||
}, function (err) {
|
||||
next(err, sessions);
|
||||
});
|
||||
}
|
||||
},
|
||||
], function (err, sessions) {
|
||||
callback(err, sessions ? sessions.map(function (sessObj) {
|
||||
sessObj.meta.datetimeISO = new Date(sessObj.meta.datetime).toISOString();
|
||||
@@ -128,7 +128,7 @@ module.exports = function (User) {
|
||||
}
|
||||
},
|
||||
async.apply(db.sortedSetRemove, 'uid:' + uid + ':sessions', sessionId),
|
||||
async.apply(db.sessionStore.destroy.bind(db.sessionStore), sessionId)
|
||||
async.apply(db.sessionStore.destroy.bind(db.sessionStore), sessionId),
|
||||
], callback);
|
||||
});
|
||||
};
|
||||
@@ -140,7 +140,7 @@ module.exports = function (User) {
|
||||
async.each(sids, function (sid, next) {
|
||||
User.auth.revokeSession(sid, uid, next);
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -169,9 +169,9 @@ module.exports = function (User) {
|
||||
async.each(sids, function (sid, next) {
|
||||
db.sessionStore.destroy(sid, next);
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}, {batch: 1000}, callback);
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports = function (User) {
|
||||
var tasks = [
|
||||
async.apply(User.setUserField, uid, 'banned', 1),
|
||||
async.apply(db.sortedSetAdd, 'users:banned', now, uid),
|
||||
async.apply(db.sortedSetAdd, 'uid:' + uid + ':bans', now, until)
|
||||
async.apply(db.sortedSetAdd, 'uid:' + uid + ':bans', now, until),
|
||||
];
|
||||
|
||||
if (until > 0 && now < until) {
|
||||
@@ -53,7 +53,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetsRemove(['users:banned', 'users:banned:expire'], uid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -75,11 +75,11 @@ module.exports = function (User) {
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetRemove.bind(db), 'users:banned:expire', uid),
|
||||
async.apply(db.sortedSetRemove.bind(db), 'users:banned', uid),
|
||||
async.apply(User.setUserFields, uid, {banned:0, 'banned:expire': 0})
|
||||
async.apply(User.setUserFields, uid, {banned:0, 'banned:expire': 0}),
|
||||
], function (err) {
|
||||
next(err, false);
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = function (User) {
|
||||
},
|
||||
all: function (next) {
|
||||
db.getSortedSetRange('categories:cid', 0, -1, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -48,7 +48,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetAdd('cid:' + cid + ':ignorers', Date.now(), uid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -69,7 +69,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetRemove('cid:' + cid + ':ignorers', uid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
@@ -42,7 +42,7 @@ module.exports = function (User) {
|
||||
'topiccount': 0,
|
||||
'lastposttime': 0,
|
||||
'banned': 0,
|
||||
'status': 'online'
|
||||
'status': 'online',
|
||||
};
|
||||
|
||||
async.parallel({
|
||||
@@ -51,7 +51,7 @@ module.exports = function (User) {
|
||||
},
|
||||
userData: function (next) {
|
||||
plugins.fireHook('filter:user.create', {user: userData, data: data}, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -106,7 +106,7 @@ module.exports = function (User) {
|
||||
if (userData.email) {
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetAdd, 'email:uid', userData.uid, userData.email.toLowerCase()),
|
||||
async.apply(db.sortedSetAdd, 'email:sorted', 0, userData.email.toLowerCase() + ':' + userData.uid)
|
||||
async.apply(db.sortedSetAdd, 'email:sorted', 0, userData.email.toLowerCase() + ':' + userData.uid),
|
||||
], next);
|
||||
|
||||
if (parseInt(userData.uid, 10) !== 1 && parseInt(meta.config.requireEmailConfirmation, 10) === 1) {
|
||||
@@ -128,13 +128,13 @@ module.exports = function (User) {
|
||||
|
||||
async.parallel([
|
||||
async.apply(User.setUserField, userData.uid, 'password', hash),
|
||||
async.apply(User.reset.updateExpiry, userData.uid)
|
||||
async.apply(User.reset.updateExpiry, userData.uid),
|
||||
], next);
|
||||
});
|
||||
},
|
||||
function (next) {
|
||||
User.updateDigestSetting(userData.uid, meta.config.dailyDigestFreq, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -143,7 +143,7 @@ module.exports = function (User) {
|
||||
}
|
||||
plugins.fireHook('action:user.create', userData);
|
||||
next(null, userData.uid);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
});
|
||||
});
|
||||
@@ -179,7 +179,7 @@ module.exports = function (User) {
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
},
|
||||
}, function (err) {
|
||||
callback(err);
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
User.deleteAccount(uid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -88,7 +88,7 @@ module.exports = function (User) {
|
||||
if (userData.email) {
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetRemove, 'email:uid', userData.email.toLowerCase()),
|
||||
async.apply(db.sortedSetRemove, 'email:sorted', userData.email.toLowerCase() + ':' + uid)
|
||||
async.apply(db.sortedSetRemove, 'email:sorted', userData.email.toLowerCase() + ':' + uid),
|
||||
], next);
|
||||
} else {
|
||||
next();
|
||||
@@ -104,7 +104,7 @@ module.exports = function (User) {
|
||||
'users:notvalidated',
|
||||
'digest:day:uids',
|
||||
'digest:week:uids',
|
||||
'digest:month:uids'
|
||||
'digest:month:uids',
|
||||
], uid, next);
|
||||
},
|
||||
function (next) {
|
||||
@@ -123,7 +123,7 @@ module.exports = function (User) {
|
||||
'uid:' + uid + ':chat:rooms', 'uid:' + uid + ':chat:rooms:unread',
|
||||
'uid:' + uid + ':upvote', 'uid:' + uid + ':downvote',
|
||||
'uid:' + uid + ':ignored:cids', 'uid:' + uid + ':flag:pids',
|
||||
'uid:' + uid + ':sessions', 'uid:' + uid + ':sessionUUID:sessionId'
|
||||
'uid:' + uid + ':sessions', 'uid:' + uid + ':sessionUUID:sessionId',
|
||||
];
|
||||
db.deleteAll(keys, next);
|
||||
},
|
||||
@@ -135,12 +135,12 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
groups.leaveAllGroups(uid, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
},
|
||||
function (results, next) {
|
||||
db.deleteAll(['followers:' + uid, 'following:' + uid, 'user:' + uid], next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -149,7 +149,7 @@ module.exports = function (User) {
|
||||
function (next) {
|
||||
async.parallel({
|
||||
upvotedPids: async.apply(db.getSortedSetRange, 'uid:' + uid + ':upvote', 0, -1),
|
||||
downvotedPids: async.apply(db.getSortedSetRange, 'uid:' + uid + ':downvote', 0, -1)
|
||||
downvotedPids: async.apply(db.getSortedSetRange, 'uid:' + uid + ':downvote', 0, -1),
|
||||
}, next);
|
||||
},
|
||||
function (pids, next) {
|
||||
@@ -160,7 +160,7 @@ module.exports = function (User) {
|
||||
async.eachSeries(pids, function (pid, next) {
|
||||
posts.unvote(pid, uid, next);
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -181,9 +181,9 @@ module.exports = function (User) {
|
||||
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetsRemove, roomKeys, uid),
|
||||
async.apply(db.deleteAll, userKeys)
|
||||
async.apply(db.deleteAll, userKeys),
|
||||
], next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -202,14 +202,14 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
db.delete('uid:' + uid + ':ip', next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
function deleteUserFromFollowers(uid, callback) {
|
||||
async.parallel({
|
||||
followers: async.apply(db.getSortedSetRange, 'followers:' + uid, 0, -1),
|
||||
following: async.apply(db.getSortedSetRange, 'following:' + uid, 0, -1)
|
||||
following: async.apply(db.getSortedSetRange, 'following:' + uid, 0, -1),
|
||||
}, function (err, results) {
|
||||
function updateCount(uids, name, fieldName, next) {
|
||||
async.each(uids, function (uid, next) {
|
||||
@@ -238,7 +238,7 @@ module.exports = function (User) {
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetsRemove, followerSets.concat(followingSets), uid),
|
||||
async.apply(updateCount, results.following, 'followers:', 'followerCount'),
|
||||
async.apply(updateCount, results.followers, 'following:', 'followingCount')
|
||||
async.apply(updateCount, results.followers, 'following:', 'followingCount'),
|
||||
], callback);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ var utils = require('../../public/src/utils');
|
||||
function (next) {
|
||||
async.parallel({
|
||||
topics: async.apply(topics.getLatestTopics, 0, 0, 9, interval),
|
||||
subscribers: async.apply(Digest.getSubscribers, interval)
|
||||
subscribers: async.apply(Digest.getSubscribers, interval),
|
||||
}, next);
|
||||
},
|
||||
function (data, next) {
|
||||
@@ -52,7 +52,7 @@ var utils = require('../../public/src/utils');
|
||||
|
||||
data.interval = interval;
|
||||
Digest.send(data, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
winston.error('[user/jobs] Could not send digests (' + interval + '): ' + err.message);
|
||||
@@ -72,12 +72,12 @@ var utils = require('../../public/src/utils');
|
||||
function (subscribers, next) {
|
||||
plugins.fireHook('filter:digest.subscribers', {
|
||||
interval: interval,
|
||||
subscribers: subscribers
|
||||
subscribers: subscribers,
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
next(null, results.subscribers);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -118,13 +118,13 @@ var utils = require('../../public/src/utils');
|
||||
site_title: meta.config.title || meta.config.browserTitle || 'NodeBB',
|
||||
notifications: notifications,
|
||||
recent: data.topics.topics,
|
||||
interval: data.interval
|
||||
interval: data.interval,
|
||||
});
|
||||
next();
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
|
||||
@@ -53,7 +53,7 @@ var emailer = require('../emailer');
|
||||
confirm_code = _confirm_code;
|
||||
db.setObject('confirm:' + confirm_code, {
|
||||
email: email.toLowerCase(),
|
||||
uid: uid
|
||||
uid: uid,
|
||||
}, next);
|
||||
},
|
||||
function (next) {
|
||||
@@ -73,7 +73,7 @@ var emailer = require('../emailer');
|
||||
|
||||
subject: subject,
|
||||
template: 'welcome',
|
||||
uid: uid
|
||||
uid: uid,
|
||||
};
|
||||
|
||||
if (plugins.hasListeners('action:user.verify')) {
|
||||
@@ -83,7 +83,7 @@ var emailer = require('../emailer');
|
||||
emailer.send('welcome', uid, data, next);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -103,7 +103,7 @@ var emailer = require('../emailer');
|
||||
},
|
||||
function (next) {
|
||||
plugins.fireHook('action:user.email.confirmed', {uid: confirmObj.uid, email: confirmObj.email}, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err ? new Error('[[error:email-confirm-failed]]') : null);
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ module.exports = function (User) {
|
||||
async.apply(db.sortedSetAdd, 'following:' + uid, now, theiruid),
|
||||
async.apply(db.sortedSetAdd, 'followers:' + theiruid, now, uid),
|
||||
async.apply(User.incrementUserFieldBy, uid, 'followingCount', 1),
|
||||
async.apply(User.incrementUserFieldBy, theiruid, 'followerCount', 1)
|
||||
async.apply(User.incrementUserFieldBy, theiruid, 'followerCount', 1),
|
||||
], next);
|
||||
} else {
|
||||
if (!isFollowing) {
|
||||
@@ -54,10 +54,10 @@ module.exports = function (User) {
|
||||
async.apply(db.sortedSetRemove, 'following:' + uid, theiruid),
|
||||
async.apply(db.sortedSetRemove, 'followers:' + theiruid, uid),
|
||||
async.apply(User.decrementUserFieldBy, uid, 'followingCount', 1),
|
||||
async.apply(User.decrementUserFieldBy, theiruid, 'followerCount', 1)
|
||||
async.apply(User.decrementUserFieldBy, theiruid, 'followerCount', 1),
|
||||
], next);
|
||||
}
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -82,12 +82,12 @@ module.exports = function (User) {
|
||||
uids: uids,
|
||||
uid: uid,
|
||||
start: start,
|
||||
stop: stop
|
||||
stop: stop,
|
||||
}, next);
|
||||
},
|
||||
function (data, next) {
|
||||
User.getUsers(data.uids, uid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ module.exports = function (User) {
|
||||
function (_reason, next) {
|
||||
reason = _reason && _reason.length ? _reason[0] : '';
|
||||
next();
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -39,7 +39,7 @@ module.exports = function (User) {
|
||||
timestamp: timestamp,
|
||||
expiry: parseInt(expiry, 10),
|
||||
expiry_readable: new Date(parseInt(expiry, 10)).toString().replace(/:/g, '%3A'),
|
||||
reason: validator.escape(String(reason))
|
||||
reason: validator.escape(String(reason)),
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -50,12 +50,12 @@ module.exports = function (User) {
|
||||
async.parallel({
|
||||
flags: async.apply(db.getSortedSetRevRangeWithScores, 'uid:' + uid + ':flag:pids', 0, 19),
|
||||
bans: async.apply(db.getSortedSetRevRangeWithScores, 'uid:' + uid + ':bans', 0, 19),
|
||||
reasons: async.apply(db.getSortedSetRevRangeWithScores, 'banned:' + uid + ':reasons', 0, 19)
|
||||
reasons: async.apply(db.getSortedSetRevRangeWithScores, 'banned:' + uid + ':reasons', 0, 19),
|
||||
}, next);
|
||||
},
|
||||
function (data, next) {
|
||||
getFlagMetadata(data, next);
|
||||
}
|
||||
},
|
||||
], function (err, data) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
@@ -37,11 +37,11 @@ module.exports = function (User) {
|
||||
invitations = invitations.map(function (invites, index) {
|
||||
return {
|
||||
uid: uids[index],
|
||||
invitations: invites
|
||||
invitations: invites,
|
||||
};
|
||||
});
|
||||
next(null, invitations);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
db.setAdd('invitation:uids', uid, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
next(err);
|
||||
});
|
||||
@@ -92,12 +92,12 @@ module.exports = function (User) {
|
||||
registerLink: registerLink,
|
||||
subject: subject,
|
||||
username: username,
|
||||
template: 'invitation'
|
||||
template: 'invitation',
|
||||
};
|
||||
|
||||
emailer.sendToEmail('invitation', email, meta.config.defaultLang, data, next);
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -116,7 +116,7 @@ module.exports = function (User) {
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -136,11 +136,11 @@ module.exports = function (User) {
|
||||
},
|
||||
function deleteInviteKey(next) {
|
||||
db.delete('invitation:email:' + email, callback);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
next(err);
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ var privileges = require('../privileges');
|
||||
},
|
||||
read: function (next) {
|
||||
getNotificationsFromSet('uid:' + uid + ':notifications:read', true, uid, start, stop, next);
|
||||
}
|
||||
},
|
||||
}, callback);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ var privileges = require('../privileges');
|
||||
}
|
||||
|
||||
notifications.merge(notifs, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ var privileges = require('../privileges');
|
||||
});
|
||||
|
||||
db.getObjectsFields(keys, ['mergeId'], next);
|
||||
}
|
||||
},
|
||||
], function (err, mergeIds) {
|
||||
// A missing (null) mergeId means that notification is counted separately.
|
||||
mergeIds = mergeIds.map(function (set) {
|
||||
@@ -195,7 +195,7 @@ var privileges = require('../privileges');
|
||||
},
|
||||
function (next) {
|
||||
db.delete('uid:' + uid + ':notifications:read', next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -229,9 +229,9 @@ var privileges = require('../privileges');
|
||||
path: '/post/' + postData.pid,
|
||||
nid: 'tid:' + postData.tid + ':uid:' + uid,
|
||||
tid: postData.tid,
|
||||
from: uid
|
||||
from: uid,
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], function (err, notification) {
|
||||
if (err) {
|
||||
return winston.error(err);
|
||||
@@ -254,7 +254,7 @@ var privileges = require('../privileges');
|
||||
notifications.create({
|
||||
bodyShort: meta.config.welcomeNotification,
|
||||
path: path,
|
||||
nid: 'welcome_' + uid
|
||||
nid: 'welcome_' + uid,
|
||||
}, function (err, notification) {
|
||||
if (err || !notification) {
|
||||
return callback(err);
|
||||
@@ -269,7 +269,7 @@ var privileges = require('../privileges');
|
||||
bodyShort: '[[user:username_taken_workaround, ' + username + ']]',
|
||||
image: 'brand:logo',
|
||||
nid: 'username_taken:' + uid,
|
||||
datetime: Date.now()
|
||||
datetime: Date.now(),
|
||||
}, function (err, notification) {
|
||||
if (!err && notification) {
|
||||
notifications.push(notification, uid);
|
||||
|
||||
@@ -34,7 +34,7 @@ module.exports = function (User) {
|
||||
|
||||
Password.compare(password, hashedPassword, next);
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ module.exports = function (User) {
|
||||
}
|
||||
async.series([
|
||||
async.apply(image.normalise, picture.path, extension),
|
||||
async.apply(fs.rename, picture.path + '.png', picture.path)
|
||||
async.apply(fs.rename, picture.path + '.png', picture.path),
|
||||
], function (err) {
|
||||
next(err);
|
||||
});
|
||||
@@ -83,7 +83,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
next(null, uploadedImage);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -153,20 +153,20 @@ module.exports = function (User) {
|
||||
md5sum = md5sum.digest('hex');
|
||||
|
||||
data.file = {
|
||||
path: path.join(os.tmpdir(), md5sum)
|
||||
path: path.join(os.tmpdir(), md5sum),
|
||||
};
|
||||
|
||||
var buffer = new Buffer(data.imageData.slice(data.imageData.indexOf('base64') + 7), 'base64');
|
||||
|
||||
fs.writeFile(data.file.path, buffer, {
|
||||
encoding: 'base64'
|
||||
encoding: 'base64',
|
||||
}, next);
|
||||
},
|
||||
function (next) {
|
||||
var image = {
|
||||
name: 'profileCover',
|
||||
path: data.file.path,
|
||||
uid: data.uid
|
||||
uid: data.uid,
|
||||
};
|
||||
|
||||
if (plugins.hasListeners('filter:uploadImage')) {
|
||||
@@ -184,9 +184,9 @@ module.exports = function (User) {
|
||||
function (upload, next) {
|
||||
next(null, {
|
||||
url: nconf.get('relative_path') + upload.url,
|
||||
name: image.name
|
||||
name: image.name,
|
||||
});
|
||||
}
|
||||
},
|
||||
], next);
|
||||
},
|
||||
function (uploadData, next) {
|
||||
@@ -200,7 +200,7 @@ module.exports = function (User) {
|
||||
}
|
||||
next();
|
||||
});
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return fs.unlink(data.file.path, function (unlinkErr) {
|
||||
@@ -243,20 +243,20 @@ module.exports = function (User) {
|
||||
md5sum = md5sum.digest('hex');
|
||||
|
||||
data.file = {
|
||||
path: path.join(os.tmpdir(), md5sum)
|
||||
path: path.join(os.tmpdir(), md5sum),
|
||||
};
|
||||
|
||||
var buffer = new Buffer(data.imageData.slice(data.imageData.indexOf('base64') + 7), 'base64');
|
||||
|
||||
fs.writeFile(data.file.path, buffer, {
|
||||
encoding: 'base64'
|
||||
encoding: 'base64',
|
||||
}, next);
|
||||
},
|
||||
function (next) {
|
||||
var image = {
|
||||
name: 'profileAvatar',
|
||||
path: data.file.path,
|
||||
uid: data.uid
|
||||
uid: data.uid,
|
||||
};
|
||||
|
||||
if (plugins.hasListeners('filter:uploadImage')) {
|
||||
@@ -274,9 +274,9 @@ module.exports = function (User) {
|
||||
function (upload, next) {
|
||||
next(null, {
|
||||
url: nconf.get('relative_path') + upload.url,
|
||||
name: image.name
|
||||
name: image.name,
|
||||
});
|
||||
}
|
||||
},
|
||||
], next);
|
||||
},
|
||||
function (uploadData, next) {
|
||||
@@ -290,7 +290,7 @@ module.exports = function (User) {
|
||||
}
|
||||
next();
|
||||
});
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
callback(err); // send back the original error
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = function (User) {
|
||||
},
|
||||
isAdminOrMod: function (next) {
|
||||
privileges.categories.isAdminOrMod(cid, uid, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -75,7 +75,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
User.updateLastOnlineTime(postData.uid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ module.exports = function (User) {
|
||||
async.apply(isSignatureValid, data),
|
||||
async.apply(isEmailAvailable, data, uid),
|
||||
async.apply(isUsernameAvailable, data, uid),
|
||||
async.apply(isGroupTitleValid, data)
|
||||
async.apply(isGroupTitleValid, data),
|
||||
], function (err) {
|
||||
next(err);
|
||||
});
|
||||
@@ -58,7 +58,7 @@ module.exports = function (User) {
|
||||
function (next) {
|
||||
plugins.fireHook('action:user.updateProfile', {data: data, uid: uid});
|
||||
User.getUserFields(uid, ['email', 'username', 'userslug', 'picture', 'icon:text', 'icon:bgColor'], next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -99,7 +99,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (available, next) {
|
||||
next(!available ? new Error('[[error:email-taken]]') : null);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (exists, next) {
|
||||
next(exists ? new Error('[[error:username-taken]]') : null);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ module.exports = function (User) {
|
||||
}
|
||||
async.series([
|
||||
async.apply(db.sortedSetRemove, 'email:uid', oldEmail.toLowerCase()),
|
||||
async.apply(db.sortedSetRemove, 'email:sorted', oldEmail.toLowerCase() + ':' + uid)
|
||||
async.apply(db.sortedSetRemove, 'email:sorted', oldEmail.toLowerCase() + ':' + uid),
|
||||
], function (err) {
|
||||
next(err);
|
||||
});
|
||||
@@ -186,11 +186,11 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetAdd('users:notvalidated', Date.now(), uid, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
next(err);
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ module.exports = function (User) {
|
||||
async.series([
|
||||
async.apply(db.sortedSetRemove, 'username:sorted', userData.username.toLowerCase() + ':' + uid),
|
||||
async.apply(db.sortedSetAdd, 'username:sorted', 0, newUsername.toLowerCase() + ':' + uid),
|
||||
async.apply(db.sortedSetAdd, 'user:' + uid + ':usernames', Date.now(), newUsername + ':' + Date.now())
|
||||
async.apply(db.sortedSetAdd, 'user:' + uid + ':usernames', Date.now(), newUsername + ':' + Date.now()),
|
||||
], next);
|
||||
},
|
||||
], callback);
|
||||
@@ -241,7 +241,7 @@ module.exports = function (User) {
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (fullname, next) {
|
||||
updateUidMapping('fullname', uid, newFullname, fullname, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -282,11 +282,11 @@ module.exports = function (User) {
|
||||
function (hashedPassword, next) {
|
||||
async.parallel([
|
||||
async.apply(User.setUserField, data.uid, 'password', hashedPassword),
|
||||
async.apply(User.reset.updateExpiry, data.uid)
|
||||
async.apply(User.reset.updateExpiry, data.uid),
|
||||
], function (err) {
|
||||
next(err);
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ var async = require('async'),
|
||||
},
|
||||
function (issueDate, next) {
|
||||
next(null, parseInt(issueDate, 10) > Date.now() - twoHours);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ var async = require('async'),
|
||||
var code = utils.generateUUID();
|
||||
async.parallel([
|
||||
async.apply(db.setObjectField, 'reset:uid', code, uid),
|
||||
async.apply(db.sortedSetAdd, 'reset:issueDate', Date.now(), code)
|
||||
async.apply(db.sortedSetAdd, 'reset:issueDate', Date.now(), code),
|
||||
], function (err) {
|
||||
callback(err, code);
|
||||
});
|
||||
@@ -52,7 +52,7 @@ var async = require('async'),
|
||||
return next(new Error('[[error:cant-reset-password-more-than-once-a-minute]]'));
|
||||
}
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -88,9 +88,9 @@ var async = require('async'),
|
||||
reset_link: reset_link,
|
||||
subject: subject,
|
||||
template: 'reset',
|
||||
uid: uid
|
||||
uid: uid,
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -124,9 +124,9 @@ var async = require('async'),
|
||||
async.apply(db.sortedSetRemove, 'reset:issueDate', code),
|
||||
async.apply(db.sortedSetRemove, 'reset:issueDate:uid', uid),
|
||||
async.apply(user.reset.updateExpiry, uid),
|
||||
async.apply(user.auth.resetLockout, uid)
|
||||
async.apply(user.auth.resetLockout, uid),
|
||||
], next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -148,7 +148,7 @@ var async = require('async'),
|
||||
},
|
||||
uids: function (next) {
|
||||
db.getSortedSetRangeByScore('reset:issueDate:uid', 0, -1, '-inf', Date.now() - twoHours, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -160,9 +160,9 @@ var async = require('async'),
|
||||
async.parallel([
|
||||
async.apply(db.deleteObjectFields, 'reset:uid', results.tokens),
|
||||
async.apply(db.sortedSetRemove, 'reset:issueDate', results.tokens),
|
||||
async.apply(db.sortedSetRemove, 'reset:issueDate:uid', results.uids)
|
||||
async.apply(db.sortedSetRemove, 'reset:issueDate:uid', results.uids),
|
||||
], next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ module.exports = function (User) {
|
||||
searchResult.timing = (process.elapsedTimeSince(startTime) / 1000).toFixed(2);
|
||||
searchResult.users = userData;
|
||||
next(null, searchResult);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -158,7 +158,7 @@ module.exports = function (User) {
|
||||
var diff = process.hrtime(start);
|
||||
var timing = (diff[0] * 1e3 + diff[1] / 1e6).toFixed(1);
|
||||
next(null, {timing: timing, users: users});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -124,7 +124,7 @@ module.exports = function (User) {
|
||||
scrollToMyPost: data.scrollToMyPost,
|
||||
notificationSound: data.notificationSound,
|
||||
incomingChatSound: data.incomingChatSound,
|
||||
outgoingChatSound: data.outgoingChatSound
|
||||
outgoingChatSound: data.outgoingChatSound,
|
||||
};
|
||||
|
||||
if (data.bootswatchSkin) {
|
||||
@@ -140,7 +140,7 @@ module.exports = function (User) {
|
||||
},
|
||||
function (next) {
|
||||
User.getSettings(uid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -155,7 +155,7 @@ module.exports = function (User) {
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ module.exports = function (User) {
|
||||
User.addTopicIdToUser = function (uid, tid, timestamp, callback) {
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetAdd, 'uid:' + uid + ':topics', timestamp, tid),
|
||||
async.apply(User.incrementUserFieldBy, uid, 'topiccount', 1)
|
||||
async.apply(User.incrementUserFieldBy, uid, 'topiccount', 1),
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user