From 530b077a8ed9885252088bf48296f6e19201685f Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 19 Oct 2015 17:13:40 +0100 Subject: [PATCH] reimplement 1a95148dae48945a3b3639c1f1b1447b27825f45 which somehow got lost during refactoring vector-web into matrix-react-sdk and vector-web --- src/controllers/organisms/RoomView.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/controllers/organisms/RoomView.js b/src/controllers/organisms/RoomView.js index ca62f72a..1300f714 100644 --- a/src/controllers/organisms/RoomView.js +++ b/src/controllers/organisms/RoomView.js @@ -365,6 +365,8 @@ module.exports = { 'm.room.topic' : sdk.getComponent('molecules.EventAsTextTile'), }; + var DateSeparator = sdk.getComponent('molecules.DateSeparator'); + var ret = []; var count = 0; @@ -373,6 +375,7 @@ module.exports = { var TileType = tileTypes[mxEv.getType()]; var continuation = false; var last = false; + var dateSeparator = null; if (i == this.state.room.timeline.length - 1) { last = true; } @@ -387,11 +390,21 @@ module.exports = { { continuation = true; } + + var ts0 = this.state.room.timeline[i - 1].getTs(); + var ts1 = this.state.room.timeline[i].getTs(); + if (new Date(ts0).toDateString() !== new Date(ts1).toDateString()) { + dateSeparator = ; + continuation = false; + } } if (!TileType) continue; ret.unshift(
  • ); + if (dateSeparator) { + ret.unshift(dateSeparator); + } ++count; } return ret;