diff options
author | Alex Ford <alexrford@users.noreply.github.com> | 2017-07-07 18:29:32 +0100 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-07-07 13:29:32 -0400 |
commit | b03b9d736297a536bb1385c80f76f55473c9f637 (patch) | |
tree | 02624e221c072f1c6d70e01e29caf41645337b64 /webapp/components/post_view | |
parent | e6ca2974cd504b26eee2549deb59b924daa4a104 (diff) | |
download | chat-b03b9d736297a536bb1385c80f76f55473c9f637.tar.gz chat-b03b9d736297a536bb1385c80f76f55473c9f637.tar.bz2 chat-b03b9d736297a536bb1385c80f76f55473c9f637.zip |
Minor fixes based on lgtm.com alerts (#6819)
* Remove a couple of superfluous trailing arguments
* Simplify assignment logic in a couple of places
* Modify some potentially inconsistent setState calls to use the function form
* Fix eslint errors
Diffstat (limited to 'webapp/components/post_view')
-rw-r--r-- | webapp/components/post_view/post_attachment.jsx | 9 | ||||
-rw-r--r-- | webapp/components/post_view/post_body_additional_content.jsx | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/webapp/components/post_view/post_attachment.jsx b/webapp/components/post_view/post_attachment.jsx index b7bd1ade9..d7b1ee774 100644 --- a/webapp/components/post_view/post_attachment.jsx +++ b/webapp/components/post_view/post_attachment.jsx @@ -55,10 +55,11 @@ export default class PostAttachment extends React.PureComponent { toggleCollapseState(e) { e.preventDefault(); - - this.setState({ - text: this.state.collapsed ? this.state.uncollapsedText : this.state.collapsedText, - collapsed: !this.state.collapsed + this.setState((prevState) => { + return { + text: prevState.collapsed ? prevState.uncollapsedText : prevState.collapsedText, + collapsed: !prevState.collapsed + }; }); } diff --git a/webapp/components/post_view/post_body_additional_content.jsx b/webapp/components/post_view/post_body_additional_content.jsx index 107c75778..2782c346f 100644 --- a/webapp/components/post_view/post_body_additional_content.jsx +++ b/webapp/components/post_view/post_body_additional_content.jsx @@ -62,7 +62,9 @@ export default class PostBodyAdditionalContent extends React.PureComponent { } toggleEmbedVisibility() { - this.setState({embedVisible: !this.state.embedVisible}); + this.setState((prevState) => { + return {embedVisible: !prevState.embedVisible}; + }); } getSlackAttachment() { |