moose-team / friends

:tv: P2P chat powered by the web.
http://moose-team.github.io/friends/
MIT License
3.17k stars 341 forks source link

Link to gh-profile on message gravatar. #126

Closed hemanth closed 9 years ago

hemanth commented 9 years ago

Had to use shell

shama commented 9 years ago

Thanks for the PR! Another way to accomplish this would be to wrap in an <a/> tag, like:

h('a', { href: userUrl, target: '_blank' }, h('img.avatar', { src: msg.avatar }))
hemanth commented 9 years ago

@shama Tried that first, but the a tag does not seem to open in a new window/browser even with target: '_blank'

shama commented 9 years ago

@hemanth Ah strange, I thought that worked. Instead of using shell.openExternal here (as that ties this element to the desktop app only), do this instead:

onclick: function (e) {
  self.send('openUrl', userUrl)
}

which should emit the event up until the desktop.js listener catches it to call shell.openExternal: https://github.com/moose-team/friends/blob/master/desktop.js#L29

hemanth commented 9 years ago

@shama Neat, thanks, makes much more sense now, have updated it to avoid direct call via shell.

shama commented 9 years ago

Thanks!

hemanth commented 9 years ago

:+1: