Merge branch 'master' into develop

v1.18.x
Julian Lam 8 years ago
commit 7f8f197e60

@ -2,7 +2,7 @@
"name": "nodebb",
"license": "GPL-3.0",
"description": "NodeBB Forum",
"version": "1.4.4",
"version": "1.4.5",
"homepage": "http://www.nodebb.org",
"repository": {
"type": "git",

@ -188,7 +188,7 @@ define('forum/account/edit', ['forum/account/header', 'translator', 'components'
function handleImageUpload(modal) {
function onUploadComplete(urlOnServer) {
urlOnServer = urlOnServer + '?' + Date.now();
urlOnServer = config.relative_path + urlOnServer + '?' + Date.now();
updateHeader(urlOnServer);

@ -127,7 +127,6 @@ var middleware;
};
Plugins.reloadRoutes = function (callback) {
callback = callback || function () {};
var router = express.Router();
router.hotswapId = 'plugins';
@ -138,7 +137,8 @@ var middleware;
var controllers = require('./controllers');
Plugins.fireHook('static:app.load', { app: app, router: router, middleware: middleware, controllers: controllers }, function (err) {
if (err) {
return winston.error('[plugins] Encountered error while executing post-router plugins hooks: ' + err.message);
winston.error('[plugins] Encountered error while executing post-router plugins hooks: ' + err.message);
return callback(err);
}
hotswap.replace('plugins', router);

@ -86,7 +86,7 @@ function groupRoutes(app, middleware, controllers) {
setupPageRoute(app, '/groups/:slug/members', middleware, middlewares, controllers.groups.members);
}
module.exports = function (app, middleware, hotswapIds) {
module.exports = function (app, middleware, hotswapIds, callback) {
var routers = [
express.Router(), // plugin router
express.Router(), // main app router
@ -210,8 +210,9 @@ module.exports = function (app, middleware, hotswapIds) {
async.apply(user.addInterstitials),
], function (err) {
if (err) {
return winston.error(err);
return callback(err);
}
winston.info('Routes added');
callback();
});
};

@ -2,7 +2,6 @@
var async = require('async');
var fs = require('fs');
var nconf = require('nconf');
var winston = require('winston');
var request = require('request');
var mime = require('mime');
@ -223,7 +222,7 @@ module.exports = function (User) {
},
function (upload, next) {
next(null, {
url: nconf.get('relative_path') + upload.url,
url: upload.url,
path: upload.path,
name: image.name,
});

@ -96,8 +96,7 @@ function initializeNodeBB(callback) {
plugins.fireHook('filter:hotswap.prepare', [], next);
},
function (hotswapIds, next) {
routes(app, middleware, hotswapIds);
next();
routes(app, middleware, hotswapIds, next);
},
function (next) {
async.series([

@ -71,7 +71,7 @@ describe('Upload Controllers', function () {
assert.equal(res.statusCode, 200);
assert(Array.isArray(body));
assert.equal(body.length, 1);
assert.equal(body[0].url, nconf.get('relative_path') + '/assets/uploads/profile/' + regularUid + '-profileavatar.png');
assert.equal(body[0].url, '/assets/uploads/profile/' + regularUid + '-profileavatar.png');
done();
});
});

@ -525,7 +525,7 @@ describe('User', function () {
};
User.uploadPicture(uid, picture, function (err, uploadedPicture) {
assert.ifError(err);
assert.equal(uploadedPicture.url, nconf.get('relative_path') + '/assets/uploads/profile/' + uid + '-profileavatar.png');
assert.equal(uploadedPicture.url, '/assets/uploads/profile/' + uid + '-profileavatar.png');
assert.equal(uploadedPicture.path, path.join(nconf.get('base_dir'), 'public', 'uploads', 'profile', uid + '-profileavatar.png'));
done();
});

Loading…
Cancel
Save