nconf fixes

v1.18.x
Baris Soner Usakli 12 years ago
parent 4d670006e1
commit f7d27cdef1

@ -52,14 +52,14 @@
if(data['userslug']) if(data['userslug'])
userLabel.attr('href','/users/' + data['userslug']); userLabel.attr('href','/users/' + data['userslug']);
if(data['picture']) if(data['picture'])
userLabel.find('img').attr('src',data['picture']+"?s=24&default=identicon"); userLabel.find('img').attr('src',data['picture']);
if(data['username']) if(data['username'])
userLabel.find('span').html(data['username']); userLabel.find('span').html(data['username']);
} }
else { else {
var userli = $('<li> \ var userli = $('<li> \
<a id="user_label" href="/users/'+data['userslug']+'"> \ <a id="user_label" href="/users/'+data['userslug']+'"> \
<img src="'+data['picture']+"?s=24&default=identicon"+'"/> \ <img src="'+data['picture']+'"/> \
<span>'+data['username']+'</span> \ <span>'+data['username']+'</span> \
</a> \ </a> \
</li>'); </li>');

@ -191,20 +191,20 @@ define(['taskbar'], function(taskbar) {
var postData = composer.posts[post_uuid], var postData = composer.posts[post_uuid],
titleEl = composer.postContainer.querySelector('input'), titleEl = composer.postContainer.querySelector('input'),
bodyEl = composer.postContainer.querySelector('textarea'); bodyEl = composer.postContainer.querySelector('textarea');
if (titleEl.value.length <= 3) { if (titleEl.value.length < 3) {
return app.alert({ return app.alert({
type: 'error', type: 'error',
timeout: 5000, timeout: 2000,
title: 'Title too short', title: 'Title too short',
message: "Please enter a longer title.", message: "Please enter a longer title.",
alert_id: 'post_error' alert_id: 'post_error'
}); });
} }
if (bodyEl.value.length <= 9) { if (bodyEl.value.length < 8) {
return app.alert({ return app.alert({
type: 'error', type: 'error',
timeout: 5000, timeout: 2000,
title: 'Content too short', title: 'Content too short',
message: "Please enter a longer post.", message: "Please enter a longer post.",
alert_id: 'post_error' alert_id: 'post_error'

@ -101,8 +101,8 @@ var user = require('./../user.js'),
uploadUserPicture(req.user.uid, req.files.userPhoto.name, req.files.userPhoto.path, res); uploadUserPicture(req.user.uid, req.files.userPhoto.name, req.files.userPhoto.path, res);
return; return;
} }
var absolutePath = path.join(global.configuration['ROOT_DIRECTORY'], config.upload_path, path.basename(oldpicture)); var absolutePath = path.join(global.configuration['ROOT_DIRECTORY'], global.nconf.get('upload_path'), path.basename(oldpicture));
fs.unlink(absolutePath, function(err) { fs.unlink(absolutePath, function(err) {
if(err) { if(err) {
@ -124,7 +124,7 @@ var user = require('./../user.js'),
} }
var filename = uid + '-profileimg' + extension; var filename = uid + '-profileimg' + extension;
var uploadPath = path.join(global.configuration['ROOT_DIRECTORY'], config.upload_path, filename); var uploadPath = path.join(global.configuration['ROOT_DIRECTORY'], global.nconf.get('upload_path'), filename);
// @todo move to proper logging code - this should only be temporary // @todo move to proper logging code - this should only be temporary
console.log('Info: Attempting upload to: '+ uploadPath); console.log('Info: Attempting upload to: '+ uploadPath);
@ -135,7 +135,7 @@ var user = require('./../user.js'),
is.on('end', function() { is.on('end', function() {
fs.unlinkSync(tempPath); fs.unlinkSync(tempPath);
var imageUrl = config.upload_url + filename; var imageUrl = global.nconf.get('upload_url') + filename;
res.json({ path: imageUrl }); res.json({ path: imageUrl });
@ -341,10 +341,7 @@ var user = require('./../user.js'),
}); });
} }
}; };
}(exports)); }(exports));

Loading…
Cancel
Save