Skip to content
Snippets Groups Projects
Commit 19d37190 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Allow pass room id to direct rooms

parent eca80058
No related branches found
No related tags found
No related merge requests found
...@@ -46,12 +46,16 @@ this.processWebhookMessage = function(messageObj, user, defaultValues) { ...@@ -46,12 +46,16 @@ this.processWebhookMessage = function(messageObj, user, defaultValues) {
username: channel username: channel
} }
] ]
}) || {};
rid = [user._id, roomUser._id].sort().join('');
room = RocketChat.models.Rooms.findOne({
_id: {
$in: [rid, channel]
}
}); });
if (roomUser == null) { if (roomUser == null && room == null) {
throw new Meteor.Error('invalid-channel'); throw new Meteor.Error('invalid-channel');
} }
rid = [user._id, roomUser._id].sort().join('');
room = RocketChat.models.Rooms.findOne(rid);
if (!room) { if (!room) {
Meteor.runAsUser(user._id, function() { Meteor.runAsUser(user._id, function() {
Meteor.call('createDirectMessage', roomUser.username); Meteor.call('createDirectMessage', roomUser.username);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment