From 47e5e8d678fd24e5ad5f9e9250db74368a28b6f7 Mon Sep 17 00:00:00 2001 From: Kieran Gould Date: Fri, 19 May 2017 22:45:56 +0100 Subject: [PATCH] Moved isTwelveHour alllll the way up to TimelinePanel. --- src/components/structures/MessagePanel.js | 13 ++++++++----- src/components/structures/TimelinePanel.js | 8 ++++++-- src/components/views/rooms/EventTile.js | 10 +++++----- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/components/structures/MessagePanel.js b/src/components/structures/MessagePanel.js index d4bf147ad5..d98a464aef 100644 --- a/src/components/structures/MessagePanel.js +++ b/src/components/structures/MessagePanel.js @@ -84,6 +84,9 @@ module.exports = React.createClass({ // shape parameter to be passed to EventTiles tileShape: React.PropTypes.string, + + // show twelve hour timestamps + isTwelveHour: React.PropTypes.bool, }, componentWillMount: function() { @@ -230,8 +233,8 @@ module.exports = React.createClass({ }, _getEventTiles: function() { - var EventTile = sdk.getComponent('rooms.EventTile'); - var DateSeparator = sdk.getComponent('messages.DateSeparator'); + const EventTile = sdk.getComponent('rooms.EventTile'); + const DateSeparator = sdk.getComponent('messages.DateSeparator'); const MemberEventListSummary = sdk.getComponent('views.elements.MemberEventListSummary'); this.eventNodes = {}; @@ -413,8 +416,8 @@ module.exports = React.createClass({ }, _getTilesForEvent: function(prevEvent, mxEv, last) { - var EventTile = sdk.getComponent('rooms.EventTile'); - var DateSeparator = sdk.getComponent('messages.DateSeparator'); + const EventTile = sdk.getComponent('rooms.EventTile'); + const DateSeparator = sdk.getComponent('messages.DateSeparator'); var ret = []; // is this a continuation of the previous message? @@ -468,7 +471,6 @@ module.exports = React.createClass({ if (this.props.manageReadReceipts) { readReceipts = this._getReadReceiptsForEvent(mxEv); } - ret.push(
  • ); diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 8794713501..c629f51c31 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -29,6 +29,7 @@ var ObjectUtils = require('../../ObjectUtils'); var Modal = require("../../Modal"); var UserActivity = require("../../UserActivity"); var KeyCode = require('../../KeyCode'); +import UserSettingsStore from '../../UserSettingsStore'; var PAGINATE_SIZE = 20; var INITIAL_SIZE = 20; @@ -122,7 +123,7 @@ var TimelinePanel = React.createClass({ let initialReadMarker = null; if (this.props.manageReadMarkers) { const readmarker = this.props.timelineSet.room.getAccountData('m.fully_read'); - if (readmarker){ + if (readmarker) { initialReadMarker = readmarker.getContent().event_id; } else { initialReadMarker = this._getCurrentReadReceipt(); @@ -171,6 +172,9 @@ var TimelinePanel = React.createClass({ // cache of matrixClient.getSyncState() (but from the 'sync' event) clientSyncState: MatrixClientPeg.get().getSyncState(), + + // should the event tiles have twelve hour times + isTwelveHour: UserSettingsStore.getSyncedSetting('showTwelveHourTimestamps'), }; }, @@ -1106,7 +1110,6 @@ var TimelinePanel = React.createClass({ const forwardPaginating = ( this.state.forwardPaginating || this.state.clientSyncState == 'PREPARED' ); - return (