mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 00:45:47 +01:00
Merge branch 'master' of github.com:NodeBB/NodeBB
This commit is contained in:
5
app.js
5
app.js
@@ -46,11 +46,6 @@ winston.add(winston.transports.Console, {
|
|||||||
level: global.env === 'production' ? 'info' : 'verbose'
|
level: global.env === 'production' ? 'info' : 'verbose'
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: remove once https://github.com/flatiron/winston/issues/280 is fixed
|
|
||||||
winston.err = function (err) {
|
|
||||||
winston.error(err.stack);
|
|
||||||
};
|
|
||||||
|
|
||||||
if(os.platform() === 'linux') {
|
if(os.platform() === 'linux') {
|
||||||
require('child_process').exec('/usr/bin/which convert', function(err, stdout, stderr) {
|
require('child_process').exec('/usr/bin/which convert', function(err, stdout, stderr) {
|
||||||
if(err || !stdout) {
|
if(err || !stdout) {
|
||||||
|
|||||||
@@ -27,6 +27,10 @@
|
|||||||
"field": "minimumPostLength",
|
"field": "minimumPostLength",
|
||||||
"value": 8
|
"value": 8
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"field": "maximumPostLength",
|
||||||
|
"value": 32767
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"field": "allowGuestSearching",
|
"field": "allowGuestSearching",
|
||||||
"value": 0
|
"value": 0
|
||||||
|
|||||||
@@ -59,11 +59,11 @@
|
|||||||
"socket.io-redis": "^0.1.3",
|
"socket.io-redis": "^0.1.3",
|
||||||
"socketio-wildcard": "~0.1.1",
|
"socketio-wildcard": "~0.1.1",
|
||||||
"string": "^3.0.0",
|
"string": "^3.0.0",
|
||||||
"templates.js": "0.1.10",
|
"templates.js": "^0.1.15",
|
||||||
"uglify-js": "git+https://github.com/julianlam/UglifyJS2.git",
|
"uglify-js": "git+https://github.com/julianlam/UglifyJS2.git",
|
||||||
"underscore": "~1.7.0",
|
"underscore": "~1.7.0",
|
||||||
"validator": "~3.26.0",
|
"validator": "~3.28.0",
|
||||||
"winston": "^0.8.1",
|
"winston": "^0.9.0",
|
||||||
"xregexp": "~2.0.0"
|
"xregexp": "~2.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
"still-uploading": "Please wait for uploads to complete.",
|
"still-uploading": "Please wait for uploads to complete.",
|
||||||
"content-too-short": "Please enter a longer post. Posts should contain at least %1 characters.",
|
"content-too-short": "Please enter a longer post. Posts should contain at least %1 characters.",
|
||||||
|
"content-too-long": "Please enter a shorter post. Posts can't be longer than %1 characters.",
|
||||||
"title-too-short": "Please enter a longer title. Titles should contain at least %1 characters.",
|
"title-too-short": "Please enter a longer title. Titles should contain at least %1 characters.",
|
||||||
"title-too-long": "Please enter a shorter title. Titles can't be longer than %1 characters.",
|
"title-too-long": "Please enter a shorter title. Titles can't be longer than %1 characters.",
|
||||||
"invalid-title": "Invalid title!",
|
"invalid-title": "Invalid title!",
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ define('forum/topic/fork', function() {
|
|||||||
|
|
||||||
forkModal.find('.close,#fork_thread_cancel').on('click', closeForkModal);
|
forkModal.find('.close,#fork_thread_cancel').on('click', closeForkModal);
|
||||||
forkModal.find('#fork-title').on('change', checkForkButtonEnable);
|
forkModal.find('#fork-title').on('change', checkForkButtonEnable);
|
||||||
$('#post-container').on('click', 'li[data-pid]', function() {
|
$('#post-container').on('click', '[data-pid]', function() {
|
||||||
togglePostSelection($(this));
|
togglePostSelection($(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ define('forum/topic/fork', function() {
|
|||||||
pids: pids
|
pids: pids
|
||||||
}, function(err, newTopic) {
|
}, function(err, newTopic) {
|
||||||
function fadeOutAndRemove(pid) {
|
function fadeOutAndRemove(pid) {
|
||||||
$('#post-container li[data-pid="' + pid + '"]').fadeOut(500, function() {
|
$('#post-container [data-pid="' + pid + '"]').fadeOut(500, function() {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -125,10 +125,10 @@ define('forum/topic/fork', function() {
|
|||||||
|
|
||||||
function closeForkModal() {
|
function closeForkModal() {
|
||||||
for(var i=0; i<pids.length; ++i) {
|
for(var i=0; i<pids.length; ++i) {
|
||||||
$('#post-container li[data-pid="' + pids[i] + '"]').css('opacity', 1);
|
$('#post-container [data-pid="' + pids[i] + '"]').css('opacity', 1);
|
||||||
}
|
}
|
||||||
forkModal.addClass('hide');
|
forkModal.addClass('hide');
|
||||||
$('#post-container').off('click', 'li[data-pid]');
|
$('#post-container').off('click', '[data-pid]');
|
||||||
enableClicksOnPosts();
|
enableClicksOnPosts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -406,6 +406,8 @@ define('composer', [
|
|||||||
return composerAlert('[[error:invalid-title]]');
|
return composerAlert('[[error:invalid-title]]');
|
||||||
} else if (bodyEl.val().length < parseInt(config.minimumPostLength, 10)) {
|
} else if (bodyEl.val().length < parseInt(config.minimumPostLength, 10)) {
|
||||||
return composerAlert('[[error:content-too-short, ' + config.minimumPostLength + ']]');
|
return composerAlert('[[error:content-too-short, ' + config.minimumPostLength + ']]');
|
||||||
|
} else if (bodyEl.val().length > parseInt(config.maximumPostLength, 10)) {
|
||||||
|
return composerAlert('[[error:content-too-long, ' + config.maximumPostLength + ']]');
|
||||||
}
|
}
|
||||||
|
|
||||||
var composerData = {}, action;
|
var composerData = {}, action;
|
||||||
|
|||||||
@@ -51,12 +51,12 @@
|
|||||||
|
|
||||||
if (!area.length && window.location.pathname.indexOf('/admin') === -1 && renderedWidgets.length) {
|
if (!area.length && window.location.pathname.indexOf('/admin') === -1 && renderedWidgets.length) {
|
||||||
if (location === 'footer' && !$('#content [widget-area="footer"]').length) {
|
if (location === 'footer' && !$('#content [widget-area="footer"]').length) {
|
||||||
$('#content').append($('<div class="col-xs-12"><div widget-area="footer"></div></div>'));
|
$('#content').append($('<div class="row"><div widget-area="footer" class="col-xs-12"></div></div>'));
|
||||||
} else if (location === 'sidebar' && !$('#content [widget-area="sidebar"]').length) {
|
} else if (location === 'sidebar' && !$('#content [widget-area="sidebar"]').length) {
|
||||||
$('#content > *').wrapAll($('<div class="col-lg-9 col-xs-12"></div>'));
|
$('#content > *').wrapAll($('<div class="row"><div class="col-lg-9 col-xs-12"></div></div>'));
|
||||||
$('#content').append($('<div class="col-lg-3 col-xs-12"><div widget-area="sidebar"></div></div>'));
|
$('#content').append($('<div class="row"><div widget-area="sidebar" class="col-lg-3 col-xs-12"></div></div>'));
|
||||||
} else if (location === 'header' && !$('#content [widget-area="header"]').length) {
|
} else if (location === 'header' && !$('#content [widget-area="header"]').length) {
|
||||||
$('#content').prepend($('<div class="col-xs-12"><div widget-area="header"></div></div>'));
|
$('#content').prepend($('<div class="row"><div widget-area="header" class="col-xs-12"></div></div>'));
|
||||||
}
|
}
|
||||||
|
|
||||||
area = $('#content [widget-area="' + location + '"]');
|
area = $('#content [widget-area="' + location + '"]');
|
||||||
|
|||||||
@@ -103,7 +103,10 @@ module.exports = function(Categories) {
|
|||||||
|
|
||||||
pids = pids.concat(topicPids).filter(function(pid, index, array) {
|
pids = pids.concat(topicPids).filter(function(pid, index, array) {
|
||||||
return !!pid && array.indexOf(pid) === index;
|
return !!pid && array.indexOf(pid) === index;
|
||||||
});
|
}).sort(function(a, b) {
|
||||||
|
return b - a;
|
||||||
|
}).slice(0, count);
|
||||||
|
|
||||||
callback(null, pids);
|
callback(null, pids);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -466,7 +466,7 @@ accountsController.uploadPicture = function (req, res, next) {
|
|||||||
|
|
||||||
fs.unlink(absolutePath, function (err) {
|
fs.unlink(absolutePath, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
winston.err(err);
|
winston.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
file.saveFileToLocal(filename, 'profile', userPhoto.path, done);
|
file.saveFileToLocal(filename, 'profile', userPhoto.path, done);
|
||||||
|
|||||||
@@ -113,11 +113,17 @@ function getStatsForSet(set, field, callback) {
|
|||||||
db.sortedSetCount(set, now - terms.month, now, next);
|
db.sortedSetCount(set, now - terms.month, now, next);
|
||||||
},
|
},
|
||||||
alltime: function(next) {
|
alltime: function(next) {
|
||||||
db.getObjectField('global', field, next);
|
getGlobalField(field, next);
|
||||||
}
|
}
|
||||||
}, callback);
|
}, 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) {
|
adminController.categories.active = function(req, res, next) {
|
||||||
filterAndRenderCategories(req, res, next, true);
|
filterAndRenderCategories(req, res, next, true);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ apiController.getConfig = function(req, res, next) {
|
|||||||
config.minimumTitleLength = meta.config.minimumTitleLength;
|
config.minimumTitleLength = meta.config.minimumTitleLength;
|
||||||
config.maximumTitleLength = meta.config.maximumTitleLength;
|
config.maximumTitleLength = meta.config.maximumTitleLength;
|
||||||
config.minimumPostLength = meta.config.minimumPostLength;
|
config.minimumPostLength = meta.config.minimumPostLength;
|
||||||
|
config.maximumPostLength = meta.config.maximumPostLength;
|
||||||
config.hasImageUploadPlugin = plugins.hasListeners('filter:uploadImage');
|
config.hasImageUploadPlugin = plugins.hasListeners('filter:uploadImage');
|
||||||
config.maximumProfileImageSize = meta.config.maximumProfileImageSize;
|
config.maximumProfileImageSize = meta.config.maximumProfileImageSize;
|
||||||
config.minimumUsernameLength = meta.config.minimumUsernameLength;
|
config.minimumUsernameLength = meta.config.minimumUsernameLength;
|
||||||
|
|||||||
@@ -690,8 +690,14 @@ var async = require('async'),
|
|||||||
|
|
||||||
Groups.acceptMembership = function(groupName, uid, callback) {
|
Groups.acceptMembership = function(groupName, uid, callback) {
|
||||||
// Note: For simplicity, this method intentially doesn't check the caller uid for ownership!
|
// Note: For simplicity, this method intentially doesn't check the caller uid for ownership!
|
||||||
db.setRemove('group:' + groupName + ':pending', uid, callback);
|
async.waterfall([
|
||||||
Groups.join.apply(Groups, arguments);
|
function(next) {
|
||||||
|
db.setRemove('group:' + groupName + ':pending', uid, next);
|
||||||
|
},
|
||||||
|
function(next) {
|
||||||
|
Groups.join(groupName, uid, next);
|
||||||
|
}
|
||||||
|
], callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
Groups.rejectMembership = function(groupName, uid, callback) {
|
Groups.rejectMembership = function(groupName, uid, callback) {
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ SocketGroups.join = function(socket, data, callback) {
|
|||||||
return callback(new Error('[[error:invalid-data]]'));
|
return callback(new Error('[[error:invalid-data]]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!parseInt(socket.uid, 10)) {
|
||||||
|
return callback(new Error('[[error:invalid-uid]]'));
|
||||||
|
}
|
||||||
|
|
||||||
if (meta.config.allowPrivateGroups !== '0') {
|
if (meta.config.allowPrivateGroups !== '0') {
|
||||||
async.parallel({
|
async.parallel({
|
||||||
isAdmin: async.apply(user.isAdministrator, socket.uid),
|
isAdmin: async.apply(user.isAdministrator, socket.uid),
|
||||||
@@ -34,6 +38,10 @@ SocketGroups.leave = function(socket, data, callback) {
|
|||||||
return callback(new Error('[[error:invalid-data]]'));
|
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);
|
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 + ']]'));
|
return callback(new Error('[[error:title-too-long, ' + meta.config.maximumTitleLength + ']]'));
|
||||||
} else if (!data.content || data.content.length < parseInt(meta.config.minimumPostLength, 10)) {
|
} else if (!data.content || data.content.length < parseInt(meta.config.minimumPostLength, 10)) {
|
||||||
return callback(new Error('[[error:content-too-short, ' + meta.config.minimumPostLength + ']]'));
|
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
|
// uid, pid, title, content, options
|
||||||
@@ -394,9 +396,6 @@ SocketPosts.flag = function(socket, pid, callback) {
|
|||||||
post;
|
post;
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
|
||||||
posts.flag(pid, next);
|
|
||||||
},
|
|
||||||
function(next) {
|
function(next) {
|
||||||
user.getUserFields(socket.uid, ['username', 'reputation'], 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]]'));
|
return next(new Error('[[error:not-enough-reputation-to-flag]]'));
|
||||||
}
|
}
|
||||||
userName = userData.username;
|
userName = userData.username;
|
||||||
|
|
||||||
posts.getPostFields(pid, ['tid', 'uid', 'content', 'deleted'], next);
|
posts.getPostFields(pid, ['tid', 'uid', 'content', 'deleted'], next);
|
||||||
},
|
},
|
||||||
function(postData, next) {
|
function(postData, next) {
|
||||||
@@ -413,7 +411,10 @@ SocketPosts.flag = function(socket, pid, callback) {
|
|||||||
return next(new Error('[[error:post-deleted]]'));
|
return next(new Error('[[error:post-deleted]]'));
|
||||||
}
|
}
|
||||||
post = postData;
|
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) {
|
function(topic, next) {
|
||||||
post.topic = topic;
|
post.topic = topic;
|
||||||
|
|||||||
@@ -289,6 +289,8 @@ module.exports = function(Topics) {
|
|||||||
function checkContentLength(content, callback) {
|
function checkContentLength(content, callback) {
|
||||||
if (!content || content.length < parseInt(meta.config.miminumPostLength, 10)) {
|
if (!content || content.length < parseInt(meta.config.miminumPostLength, 10)) {
|
||||||
return callback(new Error('[[error:content-too-short, ' + meta.config.minimumPostLength + ']]'));
|
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();
|
callback();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ module.exports = function(Topics) {
|
|||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
latestPid = pids[0];
|
latestPid = pids[0];
|
||||||
isDeleted = deleted;
|
isDeleted = parseInt(deleted, 10) === 1;
|
||||||
++index;
|
++index;
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -49,6 +49,10 @@
|
|||||||
<label>Minimum Post Length</label>
|
<label>Minimum Post Length</label>
|
||||||
<input type="number" class="form-control" value="8" data-field="minimumPostLength">
|
<input type="number" class="form-control" value="8" data-field="minimumPostLength">
|
||||||
</div>
|
</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">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" data-field="trackIpPerPost"> <strong>Track IP Address for each post</strong>
|
<input type="checkbox" data-field="trackIpPerPost"> <strong>Track IP Address for each post</strong>
|
||||||
|
|||||||
Reference in New Issue
Block a user