summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-07-10 11:07:54 -0400
committerJoram Wilander <jwawilander@gmail.com>2015-07-10 11:07:54 -0400
commitff128d7c161ead05d0cd7cc6dbbe2dbdd06259e1 (patch)
treeb150b2c0216c4c29e6e4fcc461e8a148157f338f /web
parentae939cb98d5058e597c9e85c6a069207f7d23e58 (diff)
parentfe6f9437ab141b3a433eed66faee60c1d8924a0d (diff)
downloadchat-ff128d7c161ead05d0cd7cc6dbbe2dbdd06259e1.tar.gz
chat-ff128d7c161ead05d0cd7cc6dbbe2dbdd06259e1.tar.bz2
chat-ff128d7c161ead05d0cd7cc6dbbe2dbdd06259e1.zip
Merge pull request #154 from nickago/MM-831
MM-831 Post timestamp now updates in real time
Diffstat (limited to 'web')
-rw-r--r--web/react/components/post_list.jsx5
-rw-r--r--web/react/components/sidebar_right.jsx6
2 files changed, 11 insertions, 0 deletions
diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx
index d6dc9ce30..177e4a1db 100644
--- a/web/react/components/post_list.jsx
+++ b/web/react/components/post_list.jsx
@@ -78,6 +78,7 @@ module.exports = React.createClass({
PostStore.addChangeListener(this._onChange);
ChannelStore.addChangeListener(this._onChange);
+ UserStore.addStatusesChangeListener(this._onChange);
SocketStore.addChangeListener(this._onSocketChange);
$(".post-list-holder-by-time").perfectScrollbar();
@@ -157,6 +158,7 @@ module.exports = React.createClass({
componentWillUnmount: function() {
PostStore.removeChangeListener(this._onChange);
ChannelStore.removeChangeListener(this._onChange);
+ UserStore.removeStatusesChangeListener(this._onChange);
SocketStore.removeChangeListener(this._onSocketChange);
$('body').off('click.userpopover');
},
@@ -193,6 +195,9 @@ module.exports = React.createClass({
this.scrolledToNew = false;
}
this.setState(newState);
+ } else {
+ // Updates the timestamp on each post
+ this.forceUpdate()
}
},
_onSocketChange: function(msg) {
diff --git a/web/react/components/sidebar_right.jsx b/web/react/components/sidebar_right.jsx
index 8334b345b..60c8ffae6 100644
--- a/web/react/components/sidebar_right.jsx
+++ b/web/react/components/sidebar_right.jsx
@@ -16,10 +16,16 @@ module.exports = React.createClass({
componentDidMount: function() {
PostStore.addSearchChangeListener(this._onSearchChange);
PostStore.addSelectedPostChangeListener(this._onSelectedChange);
+ UserStore.addStatusesChangeListener(this._onChange);
},
componentWillUnmount: function() {
PostStore.removeSearchChangeListener(this._onSearchChange);
PostStore.removeSelectedPostChangeListener(this._onSelectedChange);
+ UserStore.removeStatusesChangeListener(this._onChange);
+ },
+ _onChange: function() {
+ // Updates the timestamp on each post
+ this.forceUpdate();
},
_onSelectedChange: function(from_search) {
if (this.isMounted()) {