diff --git a/public/templates/account.tpl b/public/templates/account.tpl
index 058231d03a..2579de2670 100644
--- a/public/templates/account.tpl
+++ b/public/templates/account.tpl
@@ -59,7 +59,6 @@
@@ -88,16 +87,15 @@ var theirid = '{theirid}';
var editLink = $('#editLink');
var addFriendBtn = $('#add-friend-btn');
- var sendMessageBtn = $('#send-message-btn');
+
if( yourid !== theirid) {
editLink.hide();
addFriendBtn.show();
- sendMessageBtn.show();
- }
+ }
else {
addFriendBtn.hide();
- sendMessageBtn.hide();
+
}
addFriendBtn.on('click', function() {
@@ -109,9 +107,7 @@ var theirid = '{theirid}';
return false;
});
- sendMessageBtn.on('click', function() {
- return false;
- });
+
});
diff --git a/public/templates/accountedit.tpl b/public/templates/accountedit.tpl
index aa61b36b2f..c8987e3bef 100644
--- a/public/templates/accountedit.tpl
+++ b/public/templates/accountedit.tpl
@@ -79,50 +79,50 @@
diff --git a/src/routes/user.js b/src/routes/user.js
index 038c8529cf..78fbf6b030 100644
--- a/src/routes/user.js
+++ b/src/routes/user.js
@@ -136,7 +136,37 @@ var user = require('./../user.js'),
console.log('trying to upload to : '+ global.configuration['ROOT_DIRECTORY'] + uploadPath);
- fs.rename(
+ var is = fs.createReadStream(tempPath);
+ var os = fs.createWriteStream(global.configuration['ROOT_DIRECTORY'] + uploadPath);
+
+ is.pipe(os);
+
+ is.on('end', function(){
+ fs.unlinkSync(tempPath);
+
+ var imageUrl = config.upload_url + filename;
+
+ res.send({
+ path: imageUrl
+ });
+
+ user.setUserField(uid, 'uploadedpicture', imageUrl);
+ user.setUserField(uid, 'picture', imageUrl);
+
+ });
+
+ os.on('error', function(err) {
+ console.log(err);
+ });
+
+
+
+ /*util.pump(is, os, function() {
+ fs.unlinkSync('source_file');
+ });*/
+
+
+ /*fs.rename(
tempPath,
global.configuration['ROOT_DIRECTORY'] + uploadPath,
function(error) {
@@ -158,7 +188,7 @@ var user = require('./../user.js'),
user.setUserField(uid, 'picture', imageUrl);
}
- );
+ );*/
}
@@ -211,7 +241,9 @@ var user = require('./../user.js'),
});
function api_method(req, res) {
- console.log("fail "+req.params.section);
+
+
+
var callerUID = req.user?req.user.uid : 0;
if (!req.params.section && !req.params.username) {
diff --git a/src/user.js b/src/user.js
index 3b75a70315..8d47e572b3 100644
--- a/src/user.js
+++ b/src/user.js
@@ -372,6 +372,15 @@ var config = require('../config.js'),
});
}
+ User.removeFriend = function(uid, friendid, callback) {
+ RDB.srem('user:'+uid+':friends', friendid, function(err, data){
+ if(err === null)
+ callback(data);
+ else
+ console.log(err);
+ });
+ }
+
User.exists = function(username, callback) {
User.get_uid_by_username(username, function(exists) {
exists = !!exists;