Remove deprecated features at React v15.5 (#1905)
* Remove deprecated features at React v15.5
- [x] React.PropTypes
- [x] react-addons-pure-render-mixin
- [x] react-addons-test-utils
* Uncommented out & Add browserify_rails options
* re-add react-addons-shallow
* Fix syntax error from resolve conflicts
* follow up 59a77923b3
This commit is contained in:
committed by
Eugen
parent
27ea2a88c1
commit
1948f9e767
@@ -1,5 +1,5 @@
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||
import PropTypes from 'prop-types';
|
||||
import IconButton from './icon_button';
|
||||
import DropdownMenu from './dropdown_menu';
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
@@ -17,64 +17,57 @@ const messages = defineMessages({
|
||||
report: { id: 'status.report', defaultMessage: 'Report @{name}' }
|
||||
});
|
||||
|
||||
const StatusActionBar = React.createClass({
|
||||
class StatusActionBar extends React.PureComponent {
|
||||
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object
|
||||
},
|
||||
|
||||
propTypes: {
|
||||
status: ImmutablePropTypes.map.isRequired,
|
||||
onReply: React.PropTypes.func,
|
||||
onFavourite: React.PropTypes.func,
|
||||
onReblog: React.PropTypes.func,
|
||||
onDelete: React.PropTypes.func,
|
||||
onMention: React.PropTypes.func,
|
||||
onMute: React.PropTypes.func,
|
||||
onBlock: React.PropTypes.func,
|
||||
onReport: React.PropTypes.func,
|
||||
me: React.PropTypes.number.isRequired,
|
||||
intl: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
mixins: [PureRenderMixin],
|
||||
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 () {
|
||||
this.props.onReply(this.props.status, this.context.router);
|
||||
},
|
||||
}
|
||||
|
||||
handleFavouriteClick () {
|
||||
this.props.onFavourite(this.props.status);
|
||||
},
|
||||
}
|
||||
|
||||
handleReblogClick (e) {
|
||||
this.props.onReblog(this.props.status, e);
|
||||
},
|
||||
}
|
||||
|
||||
handleDeleteClick () {
|
||||
this.props.onDelete(this.props.status);
|
||||
},
|
||||
}
|
||||
|
||||
handleMentionClick () {
|
||||
this.props.onMention(this.props.status.get('account'), this.context.router);
|
||||
},
|
||||
}
|
||||
|
||||
handleMuteClick () {
|
||||
this.props.onMute(this.props.status.get('account'));
|
||||
},
|
||||
}
|
||||
|
||||
handleBlockClick () {
|
||||
this.props.onBlock(this.props.status.get('account'));
|
||||
},
|
||||
}
|
||||
|
||||
handleOpen () {
|
||||
this.context.router.push(`/statuses/${this.props.status.get('id')}`);
|
||||
},
|
||||
}
|
||||
|
||||
handleReport () {
|
||||
this.props.onReport(this.props.status);
|
||||
this.context.router.push('/report');
|
||||
},
|
||||
}
|
||||
|
||||
render () {
|
||||
const { status, me, intl } = this.props;
|
||||
@@ -119,6 +112,24 @@ const StatusActionBar = React.createClass({
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user