This commit is contained in:
barisusakli
2014-05-12 18:42:13 -04:00
parent fc00586f0e
commit c5d9a68b4b
7 changed files with 43 additions and 5 deletions

View File

@@ -11,6 +11,7 @@ var fs = require('fs'),
user = require('./../user'),
posts = require('./../posts'),
topics = require('./../topics'),
messaging = require('../messaging'),
postTools = require('../postTools'),
utils = require('./../../public/src/utils'),
meta = require('./../meta'),
@@ -448,7 +449,7 @@ accountsController.uploadPicture = function (req, res, next) {
});
}
if(err) {
if (err) {
fs.unlink(req.files.userPhoto.path);
return res.json({error:err.message});
}
@@ -487,4 +488,16 @@ accountsController.getNotifications = function(req, res, next) {
});
};
accountsController.getChats = function(req, res, next) {
messaging.getRecentChats(req.user.uid, 0, -1, function(err, chats) {
if (err) {
return next(err);
}
res.render('chats', {
chats: chats
});
});
};
module.exports = accountsController;