diff options
Diffstat (limited to 'app/javascript/mastodon/components/status_action_bar.js')
-rw-r--r-- | app/javascript/mastodon/components/status_action_bar.js | 67 |
1 files changed, 27 insertions, 40 deletions
diff --git a/app/javascript/mastodon/components/status_action_bar.js b/app/javascript/mastodon/components/status_action_bar.js index 1c2445232..b3d5e442c 100644 --- a/app/javascript/mastodon/components/status_action_bar.js +++ b/app/javascript/mastodon/components/status_action_bar.js @@ -21,52 +21,57 @@ const messages = defineMessages({ class StatusActionBar extends React.PureComponent { - constructor (props, context) { - super(props, context); - this.handleReplyClick = this.handleReplyClick.bind(this); - this.handleFavouriteClick = this.handleFavouriteClick.bind(this); - this.handleReblogClick = this.handleReblogClick.bind(this); - this.handleDeleteClick = this.handleDeleteClick.bind(this); - this.handleMentionClick = this.handleMentionClick.bind(this); - this.handleMuteClick = this.handleMuteClick.bind(this); - this.handleBlockClick = this.handleBlockClick.bind(this); - this.handleOpen = this.handleOpen.bind(this); - this.handleReport = this.handleReport.bind(this); - } - - handleReplyClick () { + static contextTypes = { + router: PropTypes.object + }; + + static propTypes = { + status: ImmutablePropTypes.map.isRequired, + onReply: PropTypes.func, + onFavourite: PropTypes.func, + onReblog: PropTypes.func, + onDelete: PropTypes.func, + onMention: PropTypes.func, + onMute: PropTypes.func, + onBlock: PropTypes.func, + onReport: PropTypes.func, + me: PropTypes.number.isRequired, + intl: PropTypes.object.isRequired + }; + + handleReplyClick = () => { this.props.onReply(this.props.status, this.context.router); } - handleFavouriteClick () { + handleFavouriteClick = () => { this.props.onFavourite(this.props.status); } - handleReblogClick (e) { + handleReblogClick = (e) => { this.props.onReblog(this.props.status, e); } - handleDeleteClick () { + handleDeleteClick = () => { this.props.onDelete(this.props.status); } - handleMentionClick () { + handleMentionClick = () => { this.props.onMention(this.props.status.get('account'), this.context.router); } - handleMuteClick () { + handleMuteClick = () => { this.props.onMute(this.props.status.get('account')); } - handleBlockClick () { + handleBlockClick = () => { this.props.onBlock(this.props.status.get('account')); } - handleOpen () { + handleOpen = () => { this.context.router.push(`/statuses/${this.props.status.get('id')}`); } - handleReport () { + handleReport = () => { this.props.onReport(this.props.status); this.context.router.push('/report'); } @@ -122,22 +127,4 @@ class StatusActionBar extends React.PureComponent { } -StatusActionBar.contextTypes = { - router: PropTypes.object -}; - -StatusActionBar.propTypes = { - status: ImmutablePropTypes.map.isRequired, - onReply: PropTypes.func, - onFavourite: PropTypes.func, - onReblog: PropTypes.func, - onDelete: PropTypes.func, - onMention: PropTypes.func, - onMute: PropTypes.func, - onBlock: PropTypes.func, - onReport: PropTypes.func, - me: PropTypes.number.isRequired, - intl: PropTypes.object.isRequired -}; - export default injectIntl(StatusActionBar); |