hipchat / hubot-hipchat

HipChat adapter for GitHub's Hubot
https://www.hipchat.com/help/page/bots
MIT License
666 stars 252 forks source link

Use a normal object when setting up the author object. #273

Closed Wilfred closed 6 years ago

Wilfred commented 8 years ago

Object.create(foo) produces an object that inherits properties from foo. This isn't necessarily harmful, but it can cause surprising behaviour:

> console.log(msg.message.user)
{ reply_to: 'test_room@conf.btf.hipchat.com',
  room: 'test_room' }
> typeof msg.message.user
"object"
> console.log(msg.message.user.name) // should be undefined, surely?
"Wilfred Hughes"

I think this is a worthwhile change as it makes debugging plugins easier.