mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-27 00:55:33 +02:00
Merge remote-tracking branch 'origin/master' into chat-kick-support
This commit is contained in:
@@ -220,6 +220,9 @@ Messaging.getTeaser = function (uid, roomId, callback) {
|
||||
Messaging.getMessageFields(mids[0], ['fromuid', 'content', 'timestamp'], next);
|
||||
},
|
||||
function (teaser, next) {
|
||||
if (!teaser) {
|
||||
return callback();
|
||||
}
|
||||
user.blocks.is(teaser.fromuid, uid, function (err, blocked) {
|
||||
if (err || blocked) {
|
||||
return callback(err);
|
||||
|
||||
@@ -221,17 +221,6 @@ module.exports = function (middleware) {
|
||||
}
|
||||
};
|
||||
|
||||
middleware.exposeUid = function (req, res, next) {
|
||||
if (!req.params.userslug) {
|
||||
return next();
|
||||
}
|
||||
|
||||
user.getUidByUserslug(req.params.userslug, function (err, uid) {
|
||||
res.locals.uid = uid;
|
||||
next(err, uid);
|
||||
});
|
||||
};
|
||||
|
||||
middleware.handleBlocking = function (req, res, next) {
|
||||
user.blocks.is(res.locals.uid, req.uid, function (err, blocked) {
|
||||
if (err) {
|
||||
|
||||
@@ -76,7 +76,7 @@ module.exports = function (User) {
|
||||
property = 'uid';
|
||||
}
|
||||
|
||||
if (!Array.isArray(set) || !(set[0].hasOwnProperty(property) || typeof set[0] === 'number' || typeof set[0] === 'string')) {
|
||||
if (!Array.isArray(set) || !set.length || !(set[0].hasOwnProperty(property) || typeof set[0] === 'number' || typeof set[0] === 'string')) {
|
||||
return callback(null, set);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user