diff options
Diffstat (limited to 'app/javascript/mastodon/features/status/index.js')
-rw-r--r-- | app/javascript/mastodon/features/status/index.js | 61 |
1 files changed, 24 insertions, 37 deletions
diff --git a/app/javascript/mastodon/features/status/index.js b/app/javascript/mastodon/features/status/index.js index 2e8c9e56a..3ce55e68e 100644 --- a/app/javascript/mastodon/features/status/index.js +++ b/app/javascript/mastodon/features/status/index.js @@ -56,18 +56,21 @@ const makeMapStateToProps = () => { class Status extends ImmutablePureComponent { - constructor (props, context) { - super(props, context); - this.handleFavouriteClick = this.handleFavouriteClick.bind(this); - this.handleReplyClick = this.handleReplyClick.bind(this); - this.handleModalReblog = this.handleModalReblog.bind(this); - this.handleReblogClick = this.handleReblogClick.bind(this); - this.handleDeleteClick = this.handleDeleteClick.bind(this); - this.handleMentionClick = this.handleMentionClick.bind(this); - this.handleOpenMedia = this.handleOpenMedia.bind(this); - this.handleOpenVideo = this.handleOpenVideo.bind(this); - this.handleReport = this.handleReport.bind(this); - } + static contextTypes = { + router: PropTypes.object + }; + + static propTypes = { + params: PropTypes.object.isRequired, + dispatch: PropTypes.func.isRequired, + status: ImmutablePropTypes.map, + ancestorsIds: ImmutablePropTypes.list, + descendantsIds: ImmutablePropTypes.list, + me: PropTypes.number, + boostModal: PropTypes.bool, + autoPlayGif: PropTypes.bool, + intl: PropTypes.object.isRequired + }; componentWillMount () { this.props.dispatch(fetchStatus(Number(this.props.params.statusId))); @@ -79,7 +82,7 @@ class Status extends ImmutablePureComponent { } } - handleFavouriteClick (status) { + handleFavouriteClick = (status) => { if (status.get('favourited')) { this.props.dispatch(unfavourite(status)); } else { @@ -87,15 +90,15 @@ class Status extends ImmutablePureComponent { } } - handleReplyClick (status) { + handleReplyClick = (status) => { this.props.dispatch(replyCompose(status, this.context.router)); } - handleModalReblog (status) { + handleModalReblog = (status) => { this.props.dispatch(reblog(status)); } - handleReblogClick (status, e) { + handleReblogClick = (status, e) => { if (status.get('reblogged')) { this.props.dispatch(unreblog(status)); } else { @@ -107,7 +110,7 @@ class Status extends ImmutablePureComponent { } } - handleDeleteClick (status) { + handleDeleteClick = (status) => { const { dispatch, intl } = this.props; dispatch(openModal('CONFIRM', { @@ -117,19 +120,19 @@ class Status extends ImmutablePureComponent { })); } - handleMentionClick (account, router) { + handleMentionClick = (account, router) => { this.props.dispatch(mentionCompose(account, router)); } - handleOpenMedia (media, index) { + handleOpenMedia = (media, index) => { this.props.dispatch(openModal('MEDIA', { media, index })); } - handleOpenVideo (media, time) { + handleOpenVideo = (media, time) => { this.props.dispatch(openModal('VIDEO', { media, time })); } - handleReport (status) { + handleReport = (status) => { this.props.dispatch(initReport(status.get('account'), status)); } @@ -180,20 +183,4 @@ class Status extends ImmutablePureComponent { } -Status.contextTypes = { - router: PropTypes.object -}; - -Status.propTypes = { - params: PropTypes.object.isRequired, - dispatch: PropTypes.func.isRequired, - status: ImmutablePropTypes.map, - ancestorsIds: ImmutablePropTypes.list, - descendantsIds: ImmutablePropTypes.list, - me: PropTypes.number, - boostModal: PropTypes.bool, - autoPlayGif: PropTypes.bool, - intl: PropTypes.object.isRequired -}; - export default injectIntl(connect(makeMapStateToProps)(Status)); |