diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-10-02 11:08:00 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-10-02 11:08:00 -0400 |
commit | 11903a38341eb55bb4c6f26ea141eccb90beabe2 (patch) | |
tree | 9988d9c39af2e29e94570af8552d8ce941200a60 /web/react/components/user_profile.jsx | |
parent | f0c8019da468895a3da89809f63d272eaf26bb59 (diff) | |
download | chat-11903a38341eb55bb4c6f26ea141eccb90beabe2.tar.gz chat-11903a38341eb55bb4c6f26ea141eccb90beabe2.tar.bz2 chat-11903a38341eb55bb4c6f26ea141eccb90beabe2.zip |
Add ability to override username and icon for posts from incoming webhooks.
Diffstat (limited to 'web/react/components/user_profile.jsx')
-rw-r--r-- | web/react/components/user_profile.jsx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/web/react/components/user_profile.jsx b/web/react/components/user_profile.jsx index c5d028d31..ceb8f52a7 100644 --- a/web/react/components/user_profile.jsx +++ b/web/react/components/user_profile.jsx @@ -31,8 +31,10 @@ export default class UserProfile extends React.Component { } componentDidMount() { UserStore.addChangeListener(this.onChange); - $('#profile_' + this.uniqueId).popover({placement: 'right', container: 'body', trigger: 'hover', html: true, delay: {show: 200, hide: 100}}); - $('body').tooltip({selector: '[data-toggle=tooltip]', trigger: 'hover click'}); + if (!this.props.disablePopover) { + $('#profile_' + this.uniqueId).popover({placement: 'right', container: 'body', trigger: 'hover', html: true, delay: {show: 200, hide: 100}}); + $('body').tooltip({selector: '[data-toggle=tooltip]', trigger: 'hover click'}); + } } componentWillUnmount() { UserStore.removeChangeListener(this.onChange); @@ -56,6 +58,10 @@ export default class UserProfile extends React.Component { name = this.props.overwriteName; } + if (this.props.disablePopover) { + return <div>{name}</div>; + } + var dataContent = '<img class="user-popover__image" src="/api/v1/users/' + this.state.profile.id + '/image?time=' + this.state.profile.update_at + '" height="128" width="128" />'; if (!global.window.config.ShowEmailAddress === 'true') { dataContent += '<div class="text-nowrap">Email not shared</div>'; @@ -79,9 +85,11 @@ export default class UserProfile extends React.Component { UserProfile.defaultProps = { userId: '', - overwriteName: '' + overwriteName: '', + disablePopover: false }; UserProfile.propTypes = { userId: React.PropTypes.string, - overwriteName: React.PropTypes.string + overwriteName: React.PropTypes.string, + disablePopover: React.PropTypes.bool }; |