Closed mydevbox closed 8 years ago
Using .+
caused other issues where attempting to remove a role would also attempt to add the same role.
If you can submit a working PR with unit tests that include ids with space I'd be happy to take a look at it.
This is the PR that broke the use of spaces: https://github.com/hubot-scripts/hubot-auth/pull/24 This was the original PR that brought the regex issue to my attention: https://github.com/hubot-scripts/hubot-auth/pull/19
I've recently attempted to upgrade from 1.2.0 to 2.0.0 and found that it no longer accepts usernames with spaces when assigning roles.
hubot: 2.19.0 adapter: HipChat nodejs: 4.5 hubot-auth: 2.0.0
When I attempt the following, I get no response.
I tracked the problem down to the @?([^\s]+) regex block which only grabs the first word. Version 1.2.0 used @?(.+) which does support spaces in usernames.
If the intent for this change was to force the use of @JoeUser instead of Joe User, the field that needs to be referenced for HipChat is 'mention_name', not 'name'.
"123456": {
"id": "123456",
"jid": "123456_123456@chat.hipchat.com",
"name": "Joe User",
"mention_name": "JoeUser",
"email_address": "joe@gmail.com",
"room": "123456_hughtest@conf.hipchat.com",
"roles": [
"my"
]
}