diff options
Diffstat (limited to 'app/core/files.js')
-rw-r--r-- | app/core/files.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/core/files.js b/app/core/files.js index 1c4dd75..90584ef 100644 --- a/app/core/files.js +++ b/app/core/files.js @@ -31,10 +31,14 @@ FileManager.prototype.create = function(options, cb) { } Room.findById(options.room, function(err, room) { + if (err) { console.error(err); return cb(err); } + if (!room) { + return cb('No room found!'); + } if (room.archived) { return cb('Room is archived.'); } @@ -59,7 +63,11 @@ FileManager.prototype.create = function(options, cb) { } cb(null, savedFile, room, user); this.core.emit('files:new', savedFile, room, user); - + options.post && this.core.messages.create({ + room: room, + owner: user, + text: 'file:' + savedFile._id + }); }.bind(this)); }.bind(this)); }.bind(this)); |