about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/compose/components/upload_button.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/mastodon/features/compose/components/upload_button.js')
-rw-r--r--app/javascript/mastodon/features/compose/components/upload_button.js29
1 files changed, 11 insertions, 18 deletions
diff --git a/app/javascript/mastodon/features/compose/components/upload_button.js b/app/javascript/mastodon/features/compose/components/upload_button.js
index 06b290467..c8c1c0c9d 100644
--- a/app/javascript/mastodon/features/compose/components/upload_button.js
+++ b/app/javascript/mastodon/features/compose/components/upload_button.js
@@ -23,24 +23,26 @@ const iconStyle = {
 
 class UploadButton extends React.PureComponent {
 
-  constructor (props, context) {
-    super(props, context);
-    this.handleChange = this.handleChange.bind(this);
-    this.handleClick = this.handleClick.bind(this);
-    this.setRef = this.setRef.bind(this);
-  }
+  static propTypes = {
+    disabled: PropTypes.bool,
+    onSelectFile: PropTypes.func.isRequired,
+    style: PropTypes.object,
+    resetFileKey: PropTypes.number,
+    acceptContentTypes: PropTypes.arrayOf(PropTypes.string).isRequired,
+    intl: PropTypes.object.isRequired
+  };
 
-  handleChange (e) {
+  handleChange = (e) => {
     if (e.target.files.length > 0) {
       this.props.onSelectFile(e.target.files);
     }
   }
 
-  handleClick () {
+  handleClick = () => {
     this.fileElement.click();
   }
 
-  setRef (c) {
+  setRef = (c) => {
     this.fileElement = c;
   }
 
@@ -67,13 +69,4 @@ class UploadButton extends React.PureComponent {
 
 }
 
-UploadButton.propTypes = {
-  disabled: PropTypes.bool,
-  onSelectFile: PropTypes.func.isRequired,
-  style: PropTypes.object,
-  resetFileKey: PropTypes.number,
-  acceptContentTypes: PropTypes.arrayOf(PropTypes.string).isRequired,
-  intl: PropTypes.object.isRequired
-};
-
 export default connect(makeMapStateToProps)(injectIntl(UploadButton));