]> cat aescling's git repositories - mastodon.git/commitdiff
Fix “read more” button behing hidden (regression from #11404) (#11522)
authorThibG <thib@sitedethib.com>
Thu, 8 Aug 2019 15:05:50 +0000 (17:05 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Thu, 8 Aug 2019 15:05:50 +0000 (17:05 +0200)
* Fix “read more” button behing hidden (regression from #11404)

This has the side-effect of putting the “Read more” button below possibly
trunctated polls instead of putting the poll below the “Read more”

* Remove dead code

app/javascript/mastodon/components/status_content.js

index 76117f1d92faa46097044a22abe747de95f08c38..6aa0bfcc265e87fc05f325cf9a01315b74487e53 100644 (file)
@@ -166,11 +166,6 @@ export default class StatusContent extends React.PureComponent {
     }
   }
 
-  handleCollapsedClick = (e) => {
-    e.preventDefault();
-    this.setState({ collapsed: !this.state.collapsed });
-  }
-
   setRef = (c) => {
     this.node = c;
   }
@@ -234,15 +229,19 @@ export default class StatusContent extends React.PureComponent {
         </div>
       );
     } else if (this.props.onClick) {
-      return (
+      const output = [
         <div className={classNames} ref={this.setRef} tabIndex='0' style={directionStyle} onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp}>
           <div className='status__content__text status__content__text--visible' style={directionStyle} dangerouslySetInnerHTML={content} lang={status.get('language')} />
 
-          {!!this.state.collapsed && readMoreButton}
-
           {!!status.get('poll') && <PollContainer pollId={status.get('poll')} />}
-        </div>
-      );
+        </div>,
+      ];
+
+      if (this.state.collapsed) {
+        output.push(readMoreButton);
+      }
+
+      return output;
     } else {
       return (
         <div className={classNames} ref={this.setRef} tabIndex='0' style={directionStyle}>