Skip to content
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

brain.users lacks user.name as it equals user.id #348

Closed
sebastiandero opened this issue Aug 23, 2016 · 3 comments
Closed

brain.users lacks user.name as it equals user.id #348

sebastiandero opened this issue Aug 23, 2016 · 3 comments
Labels
bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented

Comments

@sebastiandero
Copy link

sebastiandero commented Aug 23, 2016

  • [x ] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x ] I've read and agree to the Code of Conduct.
  • [ x] I've searched for any related issues and avoided creating a duplicate issue.

Description

The robot.brain.users list contains elements that should contain a name and id, as the slack adapter does not override them the name always equals the id.
as seen in the constructor the id is set to the name(from the hubot source: user.coffee)

constructor: (@id, options = {}) ->
    for k of (options or {})
      @[k] = options[k]
    @['name'] ||= @id.toString()

but as you can see, in the campfire.coffee adapter, also from the hubot source the name is overriden:

withAuthor = (callback) ->
      (id, created, room, user, body) ->
        bot.User user, (err, userData) ->
          if userData.user
            author = self.robot.brain.userForId(userData.user.id, userData.user)
            userId = userData.user.id
            self.robot.brain.data
              .users[userId].name = userData.user.name
            self.robot.brain.data
              .users[userId].email_address = userData.user.email_address
            author.room = room
            callback id, created, room, user, body, author

The slack adapter lacks this functionality and therefore causes unnecessary headaches.

Reproducible in:

hubot-slack version: v4.0.2

Expected result:

robot.brain.users.[position].name should return the username

Actual result:

robot.brain.users.[position].name should return the id

@DEGoodmanWilson DEGoodmanWilson added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented Priority—Medium labels Aug 25, 2016
@onbjerg
Copy link

onbjerg commented Oct 7, 2016

Any news on this? Really annoying that my bot replies to me with my ID and not my name.

@sebastiandero
Copy link
Author

Seems that there is a relation to #326

@johnagan
Copy link

closing in favor of #381

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented
Projects
None yet
Development

No branches or pull requests

4 participants