diff options
author | Simon Bartlett <simon@securitycompass.com> | 2015-02-15 18:28:05 -0500 |
---|---|---|
committer | Simon Bartlett <simon@securitycompass.com> | 2015-02-15 18:28:05 -0500 |
commit | 9563ecc202de8a799bf5a8c3e13644b570d60af2 (patch) | |
tree | d4a1f3b149643aa5065eb5a3ad69798514af537e /app/core/files.js | |
parent | 6edeac48e3709b00355b1dc36a1b3dac00d81898 (diff) | |
download | lets-chat-9563ecc202de8a799bf5a8c3e13644b570d60af2.zip lets-chat-9563ecc202de8a799bf5a8c3e13644b570d60af2.tar.gz lets-chat-9563ecc202de8a799bf5a8c3e13644b570d60af2.tar.bz2 |
Room filter is required to list files or messages
Diffstat (limited to 'app/core/files.js')
-rw-r--r-- | app/core/files.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/core/files.js b/app/core/files.js index 752ec2e..45923f3 100644 --- a/app/core/files.js +++ b/app/core/files.js @@ -102,6 +102,10 @@ FileManager.prototype.list = function(options, cb) { options = options || {}; + if (!options.room) { + return cb(null, []); + } + options = helpers.sanitizeQuery(options, { defaults: { reverse: true, @@ -113,11 +117,9 @@ FileManager.prototype.list = function(options, cb) { var File = mongoose.model('File'), User = mongoose.model('User'); - var find = File.find(); - - if (options.room) { - find.where('room', options.room); - } + var find = File.find({ + room: options.room + }); if (options.from) { find.where('uploaded').gt(options.from); |