From ba77aefe02159325752cfa79210f5e4b5fcef77e Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Wed, 15 Jun 2016 08:13:17 -0400 Subject: [PATCH] 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 --- .../components/post_view/components/post.jsx | 8 ++- .../post_view/components/post_header.jsx | 4 +- .../post_view/components/post_info.jsx | 8 +-- .../post_view/components/post_list.jsx | 2 + .../components/post_time.jsx} | 26 +++++++--- .../post_view/post_view_controller.jsx | 12 ++++- webapp/components/rhs_comment.jsx | 10 +++- webapp/components/rhs_root_post.jsx | 10 +++- webapp/components/rhs_thread.jsx | 9 +++- webapp/components/search_results.jsx | 4 +- webapp/components/search_results_item.jsx | 5 +- webapp/components/sidebar_right.jsx | 33 +++++++++++- .../user_settings/user_settings_security.jsx | 3 +- webapp/utils/constants.jsx | 3 +- webapp/utils/utils.jsx | 52 ------------------- 15 files changed, 110 insertions(+), 79 deletions(-) rename webapp/components/{time_since.jsx => post_view/components/post_time.jsx} (64%) diff --git a/webapp/components/post_view/components/post.jsx b/webapp/components/post_view/components/post.jsx index d302161807..c445ad9f31 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 cc8c0a8421..2a5ea63956 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 (