mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-07 09:33:04 +02:00
Merge branch 'master' of github.com:NodeBB/NodeBB
This commit is contained in:
@@ -103,7 +103,10 @@ module.exports = function(Categories) {
|
||||
|
||||
pids = pids.concat(topicPids).filter(function(pid, index, array) {
|
||||
return !!pid && array.indexOf(pid) === index;
|
||||
});
|
||||
}).sort(function(a, b) {
|
||||
return b - a;
|
||||
}).slice(0, count);
|
||||
|
||||
callback(null, pids);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -466,7 +466,7 @@ accountsController.uploadPicture = function (req, res, next) {
|
||||
|
||||
fs.unlink(absolutePath, function (err) {
|
||||
if (err) {
|
||||
winston.err(err);
|
||||
winston.error(err);
|
||||
}
|
||||
|
||||
file.saveFileToLocal(filename, 'profile', userPhoto.path, done);
|
||||
|
||||
@@ -113,11 +113,17 @@ function getStatsForSet(set, field, callback) {
|
||||
db.sortedSetCount(set, now - terms.month, now, next);
|
||||
},
|
||||
alltime: function(next) {
|
||||
db.getObjectField('global', field, next);
|
||||
getGlobalField(field, next);
|
||||
}
|
||||
}, callback);
|
||||
}
|
||||
|
||||
function getGlobalField(field, callback) {
|
||||
db.getObjectField('global', field, function(err, count) {
|
||||
callback(err, parseInt(count, 10) || 0);
|
||||
});
|
||||
}
|
||||
|
||||
adminController.categories.active = function(req, res, next) {
|
||||
filterAndRenderCategories(req, res, next, true);
|
||||
};
|
||||
|
||||
@@ -23,6 +23,7 @@ apiController.getConfig = function(req, res, next) {
|
||||
config.minimumTitleLength = meta.config.minimumTitleLength;
|
||||
config.maximumTitleLength = meta.config.maximumTitleLength;
|
||||
config.minimumPostLength = meta.config.minimumPostLength;
|
||||
config.maximumPostLength = meta.config.maximumPostLength;
|
||||
config.hasImageUploadPlugin = plugins.hasListeners('filter:uploadImage');
|
||||
config.maximumProfileImageSize = meta.config.maximumProfileImageSize;
|
||||
config.minimumUsernameLength = meta.config.minimumUsernameLength;
|
||||
|
||||
@@ -690,8 +690,14 @@ var async = require('async'),
|
||||
|
||||
Groups.acceptMembership = function(groupName, uid, callback) {
|
||||
// Note: For simplicity, this method intentially doesn't check the caller uid for ownership!
|
||||
db.setRemove('group:' + groupName + ':pending', uid, callback);
|
||||
Groups.join.apply(Groups, arguments);
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
db.setRemove('group:' + groupName + ':pending', uid, next);
|
||||
},
|
||||
function(next) {
|
||||
Groups.join(groupName, uid, next);
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
Groups.rejectMembership = function(groupName, uid, callback) {
|
||||
|
||||
@@ -13,6 +13,10 @@ SocketGroups.join = function(socket, data, callback) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
if (!parseInt(socket.uid, 10)) {
|
||||
return callback(new Error('[[error:invalid-uid]]'));
|
||||
}
|
||||
|
||||
if (meta.config.allowPrivateGroups !== '0') {
|
||||
async.parallel({
|
||||
isAdmin: async.apply(user.isAdministrator, socket.uid),
|
||||
@@ -34,6 +38,10 @@ SocketGroups.leave = function(socket, data, callback) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
if (!parseInt(socket.uid, 10)) {
|
||||
return callback(new Error('[[error:invalid-uid]]'));
|
||||
}
|
||||
|
||||
groups.leave(data.groupName, socket.uid, callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -261,6 +261,8 @@ SocketPosts.edit = function(socket, data, callback) {
|
||||
return callback(new Error('[[error:title-too-long, ' + meta.config.maximumTitleLength + ']]'));
|
||||
} else if (!data.content || data.content.length < parseInt(meta.config.minimumPostLength, 10)) {
|
||||
return callback(new Error('[[error:content-too-short, ' + meta.config.minimumPostLength + ']]'));
|
||||
} else if (data.content.length > parseInt(meta.config.maximumPostLength, 10)) {
|
||||
return callback(new Error('[[error:content-too-long, ' + meta.config.maximumPostLength + ']]'));
|
||||
}
|
||||
|
||||
// uid, pid, title, content, options
|
||||
@@ -394,9 +396,6 @@ SocketPosts.flag = function(socket, pid, callback) {
|
||||
post;
|
||||
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
posts.flag(pid, next);
|
||||
},
|
||||
function(next) {
|
||||
user.getUserFields(socket.uid, ['username', 'reputation'], next);
|
||||
},
|
||||
@@ -405,7 +404,6 @@ SocketPosts.flag = function(socket, pid, callback) {
|
||||
return next(new Error('[[error:not-enough-reputation-to-flag]]'));
|
||||
}
|
||||
userName = userData.username;
|
||||
|
||||
posts.getPostFields(pid, ['tid', 'uid', 'content', 'deleted'], next);
|
||||
},
|
||||
function(postData, next) {
|
||||
@@ -413,7 +411,10 @@ SocketPosts.flag = function(socket, pid, callback) {
|
||||
return next(new Error('[[error:post-deleted]]'));
|
||||
}
|
||||
post = postData;
|
||||
topics.getTopicFields(postData.tid, ['title', 'cid'], next);
|
||||
posts.flag(pid, next);
|
||||
},
|
||||
function(next) {
|
||||
topics.getTopicFields(post.tid, ['title', 'cid'], next);
|
||||
},
|
||||
function(topic, next) {
|
||||
post.topic = topic;
|
||||
|
||||
@@ -289,6 +289,8 @@ module.exports = function(Topics) {
|
||||
function checkContentLength(content, callback) {
|
||||
if (!content || content.length < parseInt(meta.config.miminumPostLength, 10)) {
|
||||
return callback(new Error('[[error:content-too-short, ' + meta.config.minimumPostLength + ']]'));
|
||||
} else if (content.length > parseInt(meta.config.maximumPostLength, 10)) {
|
||||
return callback(new Error('[[error:content-too-long, ' + meta.config.maximumPostLength + ']]'));
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ module.exports = function(Topics) {
|
||||
return next(err);
|
||||
}
|
||||
latestPid = pids[0];
|
||||
isDeleted = deleted;
|
||||
isDeleted = parseInt(deleted, 10) === 1;
|
||||
++index;
|
||||
next();
|
||||
});
|
||||
|
||||
@@ -49,6 +49,10 @@
|
||||
<label>Minimum Post Length</label>
|
||||
<input type="number" class="form-control" value="8" data-field="minimumPostLength">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Minimum Post Length</label>
|
||||
<input type="number" class="form-control" value="32767" data-field="maximumPostLength">
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" data-field="trackIpPerPost"> <strong>Track IP Address for each post</strong>
|
||||
|
||||
Reference in New Issue
Block a user