diff options
Diffstat (limited to 'app/javascript/mastodon/features/status/components/action_bar.js')
-rw-r--r-- | app/javascript/mastodon/features/status/components/action_bar.js | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/app/javascript/mastodon/features/status/components/action_bar.js b/app/javascript/mastodon/features/status/components/action_bar.js index 3bee65385..0ed149f80 100644 --- a/app/javascript/mastodon/features/status/components/action_bar.js +++ b/app/javascript/mastodon/features/status/components/action_bar.js @@ -17,37 +17,43 @@ const messages = defineMessages({ class ActionBar extends React.PureComponent { - constructor (props, context) { - super(props, context); - this.handleReplyClick = this.handleReplyClick.bind(this); - this.handleReblogClick = this.handleReblogClick.bind(this); - this.handleFavouriteClick = this.handleFavouriteClick.bind(this); - this.handleDeleteClick = this.handleDeleteClick.bind(this); - this.handleMentionClick = this.handleMentionClick.bind(this); - this.handleReport = this.handleReport.bind(this); - } - - handleReplyClick () { + static contextTypes = { + router: PropTypes.object + }; + + static propTypes = { + status: ImmutablePropTypes.map.isRequired, + onReply: PropTypes.func.isRequired, + onReblog: PropTypes.func.isRequired, + onFavourite: PropTypes.func.isRequired, + onDelete: PropTypes.func.isRequired, + onMention: PropTypes.func.isRequired, + onReport: PropTypes.func, + me: PropTypes.number.isRequired, + intl: PropTypes.object.isRequired + }; + + handleReplyClick = () => { this.props.onReply(this.props.status); } - handleReblogClick (e) { + handleReblogClick = (e) => { this.props.onReblog(this.props.status, e); } - handleFavouriteClick () { + handleFavouriteClick = () => { this.props.onFavourite(this.props.status); } - handleDeleteClick () { + handleDeleteClick = () => { this.props.onDelete(this.props.status); } - handleMentionClick () { + handleMentionClick = () => { this.props.onMention(this.props.status.get('account'), this.context.router); } - handleReport () { + handleReport = () => { this.props.onReport(this.props.status); this.context.router.push('/report'); } @@ -86,20 +92,4 @@ class ActionBar extends React.PureComponent { } -ActionBar.contextTypes = { - router: PropTypes.object -}; - -ActionBar.propTypes = { - status: ImmutablePropTypes.map.isRequired, - onReply: PropTypes.func.isRequired, - onReblog: PropTypes.func.isRequired, - onFavourite: PropTypes.func.isRequired, - onDelete: PropTypes.func.isRequired, - onMention: PropTypes.func.isRequired, - onReport: PropTypes.func, - me: PropTypes.number.isRequired, - intl: PropTypes.object.isRequired -}; - export default injectIntl(ActionBar); |