Allow pass room id to direct rooms

pull/1964/head
Rodrigo Nascimento 9 years ago
parent eca800582a
commit 19d37190c1
  1. 10
      packages/rocketchat-integrations/server/processWebhookMessage.js

@ -46,12 +46,16 @@ this.processWebhookMessage = function(messageObj, user, defaultValues) {
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');
}
rid = [user._id, roomUser._id].sort().join('');
room = RocketChat.models.Rooms.findOne(rid);
if (!room) {
Meteor.runAsUser(user._id, function() {
Meteor.call('createDirectMessage', roomUser.username);

Loading…
Cancel
Save