From 1dbe949ce8f65f1110e0f43797bd757bfa906ee0 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Tue, 23 Feb 2016 16:45:43 -0500
Subject: Removed unnecessary state from PostBodyAdditionalContent

---
 .../components/post_body_additional_content.jsx    | 26 +++-------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

(limited to 'web/react/components/post_body_additional_content.jsx')

diff --git a/web/react/components/post_body_additional_content.jsx b/web/react/components/post_body_additional_content.jsx
index c0a52dc92..a76c59fb3 100644
--- a/web/react/components/post_body_additional_content.jsx
+++ b/web/react/components/post_body_additional_content.jsx
@@ -16,30 +16,10 @@ export default class PostBodyAdditionalContent extends React.Component {
 
         this.getSlackAttachment = this.getSlackAttachment.bind(this);
         this.getOEmbedProvider = this.getOEmbedProvider.bind(this);
-
-        this.state = {
-            link: Utils.extractLinks(props.post.message)[0]
-        };
     }
 
-    componentWillReceiveProps(nextProps) {
-        if (this.props.post.message !== nextProps.post.message) {
-            this.setState({
-                link: Utils.extractLinks(nextProps.post.message)[0]
-            });
-        }
-    }
-
-    shouldComponentUpdate(nextProps, nextState) {
-        if (nextState.link !== this.state.link) {
-            return true;
-        }
-
-        if (nextProps.post.type !== this.props.post.type) {
-            return true;
-        }
-
-        if (!Utils.areObjectsEqual(nextProps.post.props, this.props.post.props)) {
+    shouldComponentUpdate(nextProps) {
+        if (!Utils.areObjectsEqual(nextProps.post, this.props.post)) {
             return true;
         }
 
@@ -76,7 +56,7 @@ export default class PostBodyAdditionalContent extends React.Component {
             return this.getSlackAttachment();
         }
 
-        const link = this.state.link;
+        const link = Utils.extractLinks(this.props.post.message)[0];
         if (!link) {
             return null;
         }
-- 
cgit v1.2.3-1-g7c22

