about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/followers/index.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/features/followers/index.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/features/followers/index.js')
-rw-r--r--app/javascript/mastodon/features/followers/index.js22
1 files changed, 8 insertions, 14 deletions
diff --git a/app/javascript/mastodon/features/followers/index.js b/app/javascript/mastodon/features/followers/index.js
index 8a1105b55..7da03da19 100644
--- a/app/javascript/mastodon/features/followers/index.js
+++ b/app/javascript/mastodon/features/followers/index.js
@@ -22,25 +22,25 @@ const mapStateToProps = (state, props) => ({
 
 class Followers extends ImmutablePureComponent {
 
-  constructor (props, context) {
-    super(props, context);
-    this.handleScroll = this.handleScroll.bind(this);
-    this.handleLoadMore = this.handleLoadMore.bind(this);
-  }
+  static propTypes = {
+    params: PropTypes.object.isRequired,
+    dispatch: PropTypes.func.isRequired,
+    accountIds: ImmutablePropTypes.list
+  };
 
   componentWillMount () {
     this.props.dispatch(fetchAccount(Number(this.props.params.accountId)));
     this.props.dispatch(fetchFollowers(Number(this.props.params.accountId)));
   }
 
-  componentWillReceiveProps(nextProps) {
+  componentWillReceiveProps (nextProps) {
     if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
       this.props.dispatch(fetchAccount(Number(nextProps.params.accountId)));
       this.props.dispatch(fetchFollowers(Number(nextProps.params.accountId)));
     }
   }
 
-  handleScroll (e) {
+  handleScroll = (e) => {
     const { scrollTop, scrollHeight, clientHeight } = e.target;
 
     if (scrollTop === scrollHeight - clientHeight) {
@@ -48,7 +48,7 @@ class Followers extends ImmutablePureComponent {
     }
   }
 
-  handleLoadMore (e) {
+  handleLoadMore = (e) => {
     e.preventDefault();
     this.props.dispatch(expandFollowers(Number(this.props.params.accountId)));
   }
@@ -83,10 +83,4 @@ class Followers extends ImmutablePureComponent {
 
 }
 
-Followers.propTypes = {
-  params: PropTypes.object.isRequired,
-  dispatch: PropTypes.func.isRequired,
-  accountIds: ImmutablePropTypes.list
-};
-
 export default connect(mapStateToProps)(Followers);