diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:04:13 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:11:58 -0700 |
commit | d8bd57901e33a7057e26e782e295099ffcc0da89 (patch) | |
tree | e12dfc8cad42b1576756d19d7fbfd82646a009bf /webapp/components/at_mention | |
parent | 7bc8e9a08dfde56387f946fdf5086252aa4d0491 (diff) | |
download | chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.gz chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.bz2 chat-d8bd57901e33a7057e26e782e295099ffcc0da89.zip |
Removing webapp
Diffstat (limited to 'webapp/components/at_mention')
-rw-r--r-- | webapp/components/at_mention/at_mention.jsx | 100 | ||||
-rw-r--r-- | webapp/components/at_mention/index.jsx | 17 |
2 files changed, 0 insertions, 117 deletions
diff --git a/webapp/components/at_mention/at_mention.jsx b/webapp/components/at_mention/at_mention.jsx deleted file mode 100644 index 668222cc2..000000000 --- a/webapp/components/at_mention/at_mention.jsx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import ProfilePopover from 'components/profile_popover.jsx'; -import Pluggable from 'plugins/pluggable'; -import {Client4} from 'mattermost-redux/client'; - -import React from 'react'; -import PropTypes from 'prop-types'; -import {OverlayTrigger} from 'react-bootstrap'; - -export default class AtMention extends React.PureComponent { - static propTypes = { - mentionName: PropTypes.string.isRequired, - usersByUsername: PropTypes.object.isRequired, - isRHS: PropTypes.bool, - hasMention: PropTypes.bool - }; - - static defaultProps = { - isRHS: false, - hasMention: false - } - - constructor(props) { - super(props); - - this.hideProfilePopover = this.hideProfilePopover.bind(this); - - this.state = { - user: this.getUserFromMentionName(props) - }; - } - - componentWillReceiveProps(nextProps) { - if (nextProps.mentionName !== this.props.mentionName || nextProps.usersByUsername !== this.props.usersByUsername) { - this.setState({ - user: this.getUserFromMentionName(nextProps) - }); - } - } - - hideProfilePopover() { - this.refs.overlay.hide(); - } - - getUserFromMentionName(props) { - const usersByUsername = props.usersByUsername; - let mentionName = props.mentionName; - - while (mentionName.length > 0) { - if (usersByUsername[mentionName]) { - return usersByUsername[mentionName]; - } - - // Repeatedly trim off trailing punctuation in case this is at the end of a sentence - if ((/[._-]$/).test(mentionName)) { - mentionName = mentionName.substring(0, mentionName.length - 1); - } else { - break; - } - } - - return ''; - } - - render() { - if (!this.state.user) { - return <span>{'@' + this.props.mentionName}</span>; - } - - const user = this.state.user; - const suffix = this.props.mentionName.substring(user.username.length); - - return ( - <span> - <OverlayTrigger - ref='overlay' - trigger='click' - placement='right' - rootClose={true} - overlay={ - <Pluggable> - <ProfilePopover - user={user} - src={Client4.getProfilePictureUrl(user.id, user.last_picture_update)} - hide={this.hideProfilePopover} - isRHS={this.props.isRHS} - hasMention={this.props.hasMention} - /> - </Pluggable> - } - > - <a className='mention-link'>{'@' + user.username}</a> - </OverlayTrigger> - {suffix} - </span> - ); - } -} diff --git a/webapp/components/at_mention/index.jsx b/webapp/components/at_mention/index.jsx deleted file mode 100644 index 37c886bbd..000000000 --- a/webapp/components/at_mention/index.jsx +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import {connect} from 'react-redux'; - -import {getUsersByUsername} from 'mattermost-redux/selectors/entities/users'; - -import AtMention from './at_mention.jsx'; - -function mapStateToProps(state, ownProps) { - return { - ...ownProps, - usersByUsername: getUsersByUsername(state) - }; -} - -export default connect(mapStateToProps)(AtMention); |