From 614992dcb7b4a4cdcedefe3ca813a03b758a97f0 Mon Sep 17 00:00:00 2001
From: nickago <ngonella@calpoly.edu>
Date: Mon, 13 Jul 2015 08:34:34 -0700
Subject: Added timestamp updates to right side and cleaned code

---
 web/react/components/post_right.jsx | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

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

diff --git a/web/react/components/post_right.jsx b/web/react/components/post_right.jsx
index 115ee87d4..89a616d27 100644
--- a/web/react/components/post_right.jsx
+++ b/web/react/components/post_right.jsx
@@ -279,9 +279,11 @@ function getStateFromStores() {
 }
 
 module.exports = React.createClass({
+    wasForced: false,
     componentDidMount: function() {
         PostStore.addSelectedPostChangeListener(this._onChange);
         PostStore.addChangeListener(this._onChangeAll);
+        UserStore.addStatusesChangeListener(this._onTimeChange);
         this.resize();
         var self = this;
         $(window).resize(function(){
@@ -289,11 +291,15 @@ module.exports = React.createClass({
         });
     },
     componentDidUpdate: function() {
-        this.resize();
+        if(!this.wasForced){
+            this.resize();
+            wasForced = false
+        }
     },
     componentWillUnmount: function() {
         PostStore.removeSelectedPostChangeListener(this._onChange);
         PostStore.removeChangeListener(this._onChangeAll);
+        UserStore.removeStatusesChangeListener(this._onTimeChange)
     },
     _onChange: function() {
         if (this.isMounted()) {
@@ -333,6 +339,14 @@ module.exports = React.createClass({
             this.setState(getStateFromStores());
         }
     },
+    _onTimeChange: function() {
+        this.wasForced = true;
+        for (var key in this.refs) {
+            if(this.refs[key].forceUpdate != undefined) {
+                this.refs[key].forceUpdate();
+            }
+        }
+    },
     getInitialState: function() {
         return getStateFromStores();
     },
@@ -392,7 +406,7 @@ module.exports = React.createClass({
                         <RootPost post={root_post} commentCount={posts_array.length}/>
                         <div className="post-right-comments-container">
                         { posts_array.map(function(cpost) {
-                                return <CommentPost key={cpost.id} post={cpost} selected={ (cpost.id == selected_post.id) } />
+                                return <CommentPost ref={cpost.id} key={cpost.id} post={cpost} selected={ (cpost.id == selected_post.id) } />
                         })}
                         </div>
                         <div className="post-create__container">
-- 
cgit v1.2.3-1-g7c22


From c3aed620316241eba48ecd2fd1f36a309bcfdff9 Mon Sep 17 00:00:00 2001
From: nickago <ngonella@calpoly.edu>
Date: Thu, 9 Jul 2015 16:37:03 -0700
Subject: Added timestamps to pictures to stop caching

---
 web/react/components/post_right.jsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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

diff --git a/web/react/components/post_right.jsx b/web/react/components/post_right.jsx
index 115ee87d4..d48b0f0ef 100644
--- a/web/react/components/post_right.jsx
+++ b/web/react/components/post_right.jsx
@@ -67,6 +67,7 @@ RootPost = React.createClass({
         var message = utils.textToJsx(this.props.post.message);
         var filenames = this.props.post.filenames;
         var isOwner = UserStore.getCurrentId() == this.props.post.user_id;
+        var timestamp = UserStore.getProfile(this.props.post.user_id).update_at;
 
         var type = "Post";
         if (this.props.post.root_id.length > 0) {
@@ -118,7 +119,7 @@ RootPost = React.createClass({
         return (
             <div className={"post post--root " + currentUserCss}>
                 <div className="post-profile-img__container">
-                    <img className="post-profile-img" src={"/api/v1/users/" + this.props.post.user_id + "/image"} height="36" width="36" />
+                    <img className="post-profile-img" src={"/api/v1/users/" + this.props.post.user_id + "/image?time=" + timestamp} height="36" width="36" />
                 </div>
                 <div className="post__content">
                     <ul className="post-header">
-- 
cgit v1.2.3-1-g7c22


From c485dad84f9a94c3d1261f7e2207baf071c2d3ca Mon Sep 17 00:00:00 2001
From: nickago <ngonella@calpoly.edu>
Date: Mon, 13 Jul 2015 09:22:42 -0700
Subject: Added update function to image update and fixed corner cases

---
 web/react/components/post_right.jsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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

diff --git a/web/react/components/post_right.jsx b/web/react/components/post_right.jsx
index d48b0f0ef..408fbf83a 100644
--- a/web/react/components/post_right.jsx
+++ b/web/react/components/post_right.jsx
@@ -228,11 +228,12 @@ CommentPost = React.createClass({
         }
 
         var message = utils.textToJsx(this.props.post.message);
+        var timestamp = UserStore.getCurrentUser().update_at;
 
         return (
             <div className={commentClass + " " + currentUserCss}>
                 <div className="post-profile-img__container">
-                    <img className="post-profile-img" src={"/api/v1/users/" + this.props.post.user_id + "/image"} height="36" width="36" />
+                    <img className="post-profile-img" src={"/api/v1/users/" + this.props.post.user_id + "/image?time=" + timestamp} height="36" width="36" />
                 </div>
                 <div className="post__content">
                     <ul className="post-header">
-- 
cgit v1.2.3-1-g7c22


From 8595b915afae9c494f09bd45692102ae86306ffe Mon Sep 17 00:00:00 2001
From: nickago <ngonella@calpoly.edu>
Date: Mon, 13 Jul 2015 11:24:39 -0700
Subject: Fixed 'this' typo and added semicolon

---
 web/react/components/post_right.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

diff --git a/web/react/components/post_right.jsx b/web/react/components/post_right.jsx
index 89a616d27..0c3754529 100644
--- a/web/react/components/post_right.jsx
+++ b/web/react/components/post_right.jsx
@@ -293,7 +293,7 @@ module.exports = React.createClass({
     componentDidUpdate: function() {
         if(!this.wasForced){
             this.resize();
-            wasForced = false
+            this.wasForced = false;
         }
     },
     componentWillUnmount: function() {
-- 
cgit v1.2.3-1-g7c22


From 634df1c6242772e44fed5f64ac238adf2d0503a0 Mon Sep 17 00:00:00 2001
From: nickago <ngonella@calpoly.edu>
Date: Tue, 14 Jul 2015 07:54:09 -0700
Subject: Added semicolons

---
 web/react/components/post_right.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

diff --git a/web/react/components/post_right.jsx b/web/react/components/post_right.jsx
index 0c3754529..ab818c1bd 100644
--- a/web/react/components/post_right.jsx
+++ b/web/react/components/post_right.jsx
@@ -299,7 +299,7 @@ module.exports = React.createClass({
     componentWillUnmount: function() {
         PostStore.removeSelectedPostChangeListener(this._onChange);
         PostStore.removeChangeListener(this._onChangeAll);
-        UserStore.removeStatusesChangeListener(this._onTimeChange)
+        UserStore.removeStatusesChangeListener(this._onTimeChange);
     },
     _onChange: function() {
         if (this.isMounted()) {
-- 
cgit v1.2.3-1-g7c22


From d9afa47ef803f3069427192acf839d21bb5a8d93 Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Tue, 14 Jul 2015 08:07:01 -0400
Subject: Revert "MM-831 Time change ping riding on the status interupt for
 timestamp update"

---
 web/react/components/post_right.jsx | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

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

diff --git a/web/react/components/post_right.jsx b/web/react/components/post_right.jsx
index 27195dfba..408fbf83a 100644
--- a/web/react/components/post_right.jsx
+++ b/web/react/components/post_right.jsx
@@ -281,11 +281,9 @@ function getStateFromStores() {
 }
 
 module.exports = React.createClass({
-    wasForced: false,
     componentDidMount: function() {
         PostStore.addSelectedPostChangeListener(this._onChange);
         PostStore.addChangeListener(this._onChangeAll);
-        UserStore.addStatusesChangeListener(this._onTimeChange);
         this.resize();
         var self = this;
         $(window).resize(function(){
@@ -293,15 +291,11 @@ module.exports = React.createClass({
         });
     },
     componentDidUpdate: function() {
-        if(!this.wasForced){
-            this.resize();
-            this.wasForced = false;
-        }
+        this.resize();
     },
     componentWillUnmount: function() {
         PostStore.removeSelectedPostChangeListener(this._onChange);
         PostStore.removeChangeListener(this._onChangeAll);
-        UserStore.removeStatusesChangeListener(this._onTimeChange);
     },
     _onChange: function() {
         if (this.isMounted()) {
@@ -341,14 +335,6 @@ module.exports = React.createClass({
             this.setState(getStateFromStores());
         }
     },
-    _onTimeChange: function() {
-        this.wasForced = true;
-        for (var key in this.refs) {
-            if(this.refs[key].forceUpdate != undefined) {
-                this.refs[key].forceUpdate();
-            }
-        }
-    },
     getInitialState: function() {
         return getStateFromStores();
     },
@@ -408,7 +394,7 @@ module.exports = React.createClass({
                         <RootPost post={root_post} commentCount={posts_array.length}/>
                         <div className="post-right-comments-container">
                         { posts_array.map(function(cpost) {
-                                return <CommentPost ref={cpost.id} key={cpost.id} post={cpost} selected={ (cpost.id == selected_post.id) } />
+                                return <CommentPost key={cpost.id} post={cpost} selected={ (cpost.id == selected_post.id) } />
                         })}
                         </div>
                         <div className="post-create__container">
-- 
cgit v1.2.3-1-g7c22

