about summary refs log tree commit diff
path: root/app/javascript/mastodon/components/status_action_bar.js
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-05-12 21:44:10 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-12 14:44:10 +0200
commit2991a7cfe685ca9b42230b7030b9e7d0ece94c88 (patch)
tree72da0f02bc6279aeab1e641fb7d51527efcb9066 /app/javascript/mastodon/components/status_action_bar.js
parent44a3584e2d54488393e6f50e482ed61d2765e312 (diff)
Use ES Class Fields & Static Properties (#3008)
Use ES Class Fields & Static Properties (currently stage 2) for improve class outlook.

Added babel-plugin-transform-class-properties as a Babel plugin.
Diffstat (limited to 'app/javascript/mastodon/components/status_action_bar.js')
-rw-r--r--app/javascript/mastodon/components/status_action_bar.js67
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);