diff options
author | Houssam Haidar <houssam@sdelements.com> | 2016-04-03 20:04:43 -0500 |
---|---|---|
committer | Houssam Haidar <houssam@sdelements.com> | 2016-04-03 20:04:43 -0500 |
commit | 459229499d861efac7bda10c99f74c46f94a1c22 (patch) | |
tree | 2183cee64ed074a9708a8c9bb276944b69c95d92 | |
parent | 9dcc1dfb51dc71efcf1389b0cf185d109453fa5b (diff) | |
download | lets-chat-459229499d861efac7bda10c99f74c46f94a1c22.zip lets-chat-459229499d861efac7bda10c99f74c46f94a1c22.tar.gz lets-chat-459229499d861efac7bda10c99f74c46f94a1c22.tar.bz2 |
Fix lodash and multer issues
-rw-r--r-- | app/controllers/files.js | 10 | ||||
-rw-r--r-- | app/core/files.js | 2 | ||||
-rw-r--r-- | app/core/rooms.js | 4 | ||||
-rw-r--r-- | app/xmpp/events/user-avatar-ready.js | 2 | ||||
-rw-r--r-- | app/xmpp/events/user-connect.js | 2 | ||||
-rw-r--r-- | app/xmpp/events/user-disconnect.js | 2 | ||||
-rw-r--r-- | app/xmpp/msg-processor.js | 2 | ||||
-rw-r--r-- | app/xmpp/msg-processors/root-join.js | 2 | ||||
-rw-r--r-- | app/xmpp/msg-processors/roster-get.js | 2 |
9 files changed, 14 insertions, 14 deletions
diff --git a/app/controllers/files.js b/app/controllers/files.js index 0738972..c46e93a 100644 --- a/app/controllers/files.js +++ b/app/controllers/files.js @@ -28,12 +28,12 @@ module.exports = function() { });
var fileUpload = multer({
- putSingleFilesInArray: true,
limits: {
files: 1,
fileSize: settings.maxFileSize
- }
- });
+ },
+ storage: multer.diskStorage({})
+ }).any();
//
// Routes
@@ -84,14 +84,14 @@ module.exports = function() { //
app.io.route('files', {
create: function(req, res) {
- if (!req.files || !req.files.file) {
+ if (!req.files) {
return res.sendStatus(400);
}
var options = {
owner: req.user._id,
room: req.param('room'),
- file: req.files.file[0],
+ file: req.files[0],
post: (req.param('post') === 'true') && true
};
diff --git a/app/core/files.js b/app/core/files.js index aade909..ed989f0 100644 --- a/app/core/files.js +++ b/app/core/files.js @@ -38,7 +38,7 @@ FileManager.prototype.create = function(options, cb) { if (settings.restrictTypes && settings.allowedTypes && settings.allowedTypes.length && - !_.include(settings.allowedTypes, options.file.mimetype)) { + !_.includes(settings.allowedTypes, options.file.mimetype)) { return cb('The MIME type ' + options.file.mimetype + ' is not allowed'); } diff --git a/app/core/rooms.js b/app/core/rooms.js index 688b927..fbb746a 100644 --- a/app/core/rooms.js +++ b/app/core/rooms.js @@ -197,10 +197,10 @@ RoomManager.prototype.list = function(options, cb) { _.each(rooms, function(room) { this.sanitizeRoom(options, room); - }, this); + }.bind(this)); if (options.users && !options.sort) { - rooms = _.sortByAll(rooms, ['userCount', 'lastActive']) + rooms = _.sortBy(rooms, ['userCount', 'lastActive']) .reverse(); } diff --git a/app/xmpp/events/user-avatar-ready.js b/app/xmpp/events/user-avatar-ready.js index f51c379..b562b38 100644 --- a/app/xmpp/events/user-avatar-ready.js +++ b/app/xmpp/events/user-avatar-ready.js @@ -41,7 +41,7 @@ module.exports = EventListener.extend({ connection.populateVcard(presence, user, this.core); this.send(connection, presence); - }, this); + }.bind(this)); } }); diff --git a/app/xmpp/events/user-connect.js b/app/xmpp/events/user-connect.js index b2724da..3467be8 100644 --- a/app/xmpp/events/user-connect.js +++ b/app/xmpp/events/user-connect.js @@ -65,7 +65,7 @@ module.exports = EventListener.extend({ this.send(x, presence); - }, this); + }.bind(this)); } }); diff --git a/app/xmpp/events/user-disconnect.js b/app/xmpp/events/user-disconnect.js index 2c6bfe8..a7076d5 100644 --- a/app/xmpp/events/user-disconnect.js +++ b/app/xmpp/events/user-disconnect.js @@ -45,7 +45,7 @@ module.exports = EventListener.extend({ this.send(x, presence); - }, this); + }.bind(this)); } }); diff --git a/app/xmpp/msg-processor.js b/app/xmpp/msg-processor.js index 7e5cbba..4625871 100644 --- a/app/xmpp/msg-processor.js +++ b/app/xmpp/msg-processor.js @@ -111,7 +111,7 @@ MessageProcessor.extend = function(options) { _.forEach(this.methods, function(key) { this[key] = this[key].bind(this); - }, this); + }.bind(this)); }; util.inherits(processor, MessageProcessor); diff --git a/app/xmpp/msg-processors/root-join.js b/app/xmpp/msg-processors/root-join.js index 8ecb5c8..587112a 100644 --- a/app/xmpp/msg-processors/root-join.js +++ b/app/xmpp/msg-processors/root-join.js @@ -38,7 +38,7 @@ module.exports = MessageProcessor.extend({ msgs.push(presence); - }, this); + }.bind(this)); cb(null, msgs); } diff --git a/app/xmpp/msg-processors/roster-get.js b/app/xmpp/msg-processors/roster-get.js index fa3262c..3ada392 100644 --- a/app/xmpp/msg-processors/roster-get.js +++ b/app/xmpp/msg-processors/roster-get.js @@ -60,7 +60,7 @@ module.exports = MessageProcessor.extend({ name: user.displayName, subscription: 'both' }).c('group').t('Let\'s Chat'); - }, this); + }.bind(this)); cb(null, stanza); } |