Skip to content
Snippets Groups Projects
Commit 25d19bfb authored by Gabriel Engel's avatar Gabriel Engel Committed by GitHub
Browse files

Merge pull request #5698 from RocketChat/fix-rest-api-ignoring-subscriptions-post-message

Fix chat.postMessage not behaving like the web client
parents 65288148 22f63e47
No related branches found
No related tags found
No related merge requests found
......@@ -5,9 +5,14 @@ function retrieveRoomInfo({ currentUserId, channel, ignoreEmpty=false }) {
}
if (room && room.t === 'c') {
Meteor.runAsUser(currentUserId, function() {
return Meteor.call('joinRoom', room._id);
});
//Check if the user already has a Subscription or not, this avoids this issue: https://github.com/RocketChat/Rocket.Chat/issues/5477
const sub = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(room._id, currentUserId);
if (!sub) {
Meteor.runAsUser(currentUserId, function() {
return Meteor.call('joinRoom', room._id);
});
}
}
return room;
......
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