From ba77aefe02159325752cfa79210f5e4b5fcef77e Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Wed, 15 Jun 2016 08:13:17 -0400 Subject: PLT-3202 Re-render timestamps when display settings switch between 12h and 24h (#3337) * Made post timestamp switch from 12h to 24h without refreshing * Made RHS post timestamps switch from 12h to 24h without refreshing --- webapp/components/post_view/components/post.jsx | 8 +++- .../post_view/components/post_header.jsx | 4 +- .../components/post_view/components/post_info.jsx | 8 ++-- .../components/post_view/components/post_list.jsx | 2 + .../components/post_view/components/post_time.jsx | 52 ++++++++++++++++++++++ .../components/post_view/post_view_controller.jsx | 12 ++++- 6 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 webapp/components/post_view/components/post_time.jsx (limited to 'webapp/components/post_view') diff --git a/webapp/components/post_view/components/post.jsx b/webapp/components/post_view/components/post.jsx index d30216180..c445ad9f3 100644 --- a/webapp/components/post_view/components/post.jsx +++ b/webapp/components/post_view/components/post.jsx @@ -76,6 +76,10 @@ export default class Post extends React.Component { return true; } + if (nextProps.useMilitaryTime !== this.props.useMilitaryTime) { + return true; + } + if (!Utils.areObjectsEqual(nextProps.user, this.props.user)) { return true; } @@ -187,6 +191,7 @@ export default class Post extends React.Component { currentUser={this.props.currentUser} compactDisplay={this.props.compactDisplay} displayNameType={this.props.displayNameType} + useMilitaryTime={this.props.useMilitaryTime} /> @@ -91,5 +92,6 @@ PostHeader.propTypes = { handleCommentClick: React.PropTypes.func.isRequired, sameUser: React.PropTypes.bool.isRequired, compactDisplay: React.PropTypes.bool, - displayNameType: React.PropTypes.string + displayNameType: React.PropTypes.string, + useMilitaryTime: React.PropTypes.bool.isRequired }; diff --git a/webapp/components/post_view/components/post_info.jsx b/webapp/components/post_view/components/post_info.jsx index cc8c0a842..2a5ea6395 100644 --- a/webapp/components/post_view/components/post_info.jsx +++ b/webapp/components/post_view/components/post_info.jsx @@ -3,7 +3,7 @@ import $ from 'jquery'; import * as Utils from 'utils/utils.jsx'; -import TimeSince from 'components/time_since.jsx'; +import PostTime from './post_time.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; import TeamStore from 'stores/team_store.jsx'; import UserStore from 'stores/user_store.jsx'; @@ -217,10 +217,11 @@ export default class PostInfo extends React.Component { return (