-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NEW] Do not rate limit bots on createDirectMessage #7326
[NEW] Do not rate limit bots on createDirectMessage #7326
Conversation
2532f57
to
af31639
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First off thanks for contributing! Second, i'd like to suggest doing based on permission instead of on role.
connectionId() { | ||
return true; | ||
userId(userId) { | ||
const user = RocketChat.models.Users.findOneById(userId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use RocketChat.authz.hasPermission(userId, permissionNode)
instead of finding a user by id and checking the role.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
af31639
to
6f64e37
Compare
Follow up question: does the |
Was a migration created to apply this to existing bots? If not, then it's kind of pointless to use that permission for previous systems and will only apply to new bots. |
@graywolf336 No, I didn't add a migration, didn't think of it. I can add this in a follow-up PR, if you like? |
@jangmarker That would be great. Mark it as a |
I might be mistaken here, but I understand the permission+roles system to work as follows:
So as long as all bots have the Is that correct? |
@jangmarker looks like you're correct. If you modify a permission a migration is needed but looks like if a new one is created no migration is needed: https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/rocketchat-authorization/server/startup.js#L69 |
Thanks for confirming :-). Then I think nothing is left for this PR except waiting for it be merged. Thanks for all your help and patience. |
@RocketChat/core
Closes #7302
The code is adapted from similar code in sendMessage.js, including the fix of #7325.