mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-16 13:37:57 +02:00
Merge branch 'master' into develop
This commit is contained in:
@@ -77,13 +77,10 @@
|
||||
var connString = 'mongodb://' + usernamePassword + servers.join() + '/' + nconf.get('mongo:database');
|
||||
|
||||
var connOptions = {
|
||||
server: {
|
||||
poolSize: parseInt(nconf.get('mongo:poolSize'), 10) || 10,
|
||||
socketOptions: { keepAlive: nconf.get('mongo:keepAlive') || 0 },
|
||||
reconnectTries: 3600,
|
||||
reconnectInterval: 1000,
|
||||
auto_reconnect: true,
|
||||
},
|
||||
poolSize: 10,
|
||||
reconnectTries: 3600,
|
||||
reconnectInterval: 1000,
|
||||
autoReconnect: true,
|
||||
};
|
||||
|
||||
connOptions = _.deepExtend(connOptions, nconf.get('mongo:options') || {});
|
||||
|
||||
@@ -109,6 +109,34 @@ function compile(callback) {
|
||||
var baseTemplatesPaths = themeConfig.baseTheme ? getBaseTemplates(themeConfig.baseTheme) : [nconf.get('base_templates_path')];
|
||||
var viewsPath = nconf.get('views_dir');
|
||||
|
||||
function processImports(paths, relativePath, source, callback) {
|
||||
var regex = /<!-- IMPORT (.+?) -->/;
|
||||
|
||||
var matches = source.match(regex);
|
||||
|
||||
if (!matches) {
|
||||
return callback(null, source);
|
||||
}
|
||||
|
||||
var partial = '/' + matches[1];
|
||||
if (paths[partial] && relativePath !== partial) {
|
||||
fs.readFile(paths[partial], function (err, file) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
var partialSource = file.toString();
|
||||
source = source.replace(regex, partialSource);
|
||||
|
||||
processImports(paths, relativePath, source, callback);
|
||||
});
|
||||
} else {
|
||||
winston.warn('[meta/templates] Partial not loaded: ' + matches[1]);
|
||||
source = source.replace(regex, '');
|
||||
|
||||
processImports(paths, relativePath, source, callback);
|
||||
}
|
||||
}
|
||||
|
||||
preparePaths(baseTemplatesPaths, function (err, paths) {
|
||||
if (err) {
|
||||
@@ -116,24 +144,23 @@ function compile(callback) {
|
||||
}
|
||||
|
||||
async.each(Object.keys(paths), function (relativePath, next) {
|
||||
var file = fs.readFileSync(paths[relativePath]).toString();
|
||||
var regex = /[ \t]*<!-- IMPORT ([\s\S]*?)? -->[ \t]*/;
|
||||
var matches = file.match(regex);
|
||||
|
||||
while (matches !== null) {
|
||||
var partial = '/' + matches[1];
|
||||
|
||||
if (paths[partial] && relativePath !== partial) {
|
||||
file = file.replace(regex, fs.readFileSync(paths[partial]).toString());
|
||||
} else {
|
||||
winston.warn('[meta/templates] Partial not loaded: ' + matches[1]);
|
||||
file = file.replace(regex, '');
|
||||
}
|
||||
matches = file.match(regex);
|
||||
}
|
||||
|
||||
mkdirp.sync(path.join(viewsPath, relativePath.split('/').slice(0, -1).join('/')));
|
||||
fs.writeFile(path.join(viewsPath, relativePath), file, next);
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
fs.readFile(paths[relativePath], next);
|
||||
},
|
||||
function (file, next) {
|
||||
var source = file.toString();
|
||||
processImports(paths, relativePath, source, next);
|
||||
},
|
||||
function (compiled, next) {
|
||||
mkdirp(path.join(viewsPath, path.dirname(relativePath)), function (err) {
|
||||
next(err, compiled);
|
||||
});
|
||||
},
|
||||
function (compiled, next) {
|
||||
fs.writeFile(path.join(viewsPath, relativePath), compiled, next);
|
||||
},
|
||||
], next);
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
winston.error('[meta/templates] ' + err.stack);
|
||||
|
||||
@@ -28,10 +28,10 @@ module.exports = function (User) {
|
||||
email: data.email || '',
|
||||
joindate: timestamp,
|
||||
lastonline: timestamp,
|
||||
picture: '',
|
||||
picture: data.picture || '',
|
||||
fullname: data.fullname || '',
|
||||
location: '',
|
||||
birthday: '',
|
||||
location: data.location || '',
|
||||
birthday: data.birthday || '',
|
||||
website: '',
|
||||
signature: '',
|
||||
uploadedpicture: '',
|
||||
@@ -210,8 +210,7 @@ module.exports = function (User) {
|
||||
|
||||
function go() {
|
||||
var username = userData.username + ' ' + num.toString(32);
|
||||
var userslug = utils.slugify(username);
|
||||
meta.userOrGroupExists(userslug, function (err, exists) {
|
||||
meta.userOrGroupExists(username, function (err, exists) {
|
||||
if (err || !exists) {
|
||||
return callback(err, username);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user