Skip to content

Commit 530b077

Browse files
committed
reimplement 1a95148 which somehow got lost during refactoring vector-web into matrix-react-sdk and vector-web
1 parent 11aa6f8 commit 530b077

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/controllers/organisms/RoomView.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,8 @@ module.exports = {
365365
'm.room.topic' : sdk.getComponent('molecules.EventAsTextTile'),
366366
};
367367

368+
var DateSeparator = sdk.getComponent('molecules.DateSeparator');
369+
368370
var ret = [];
369371
var count = 0;
370372

@@ -373,6 +375,7 @@ module.exports = {
373375
var TileType = tileTypes[mxEv.getType()];
374376
var continuation = false;
375377
var last = false;
378+
var dateSeparator = null;
376379
if (i == this.state.room.timeline.length - 1) {
377380
last = true;
378381
}
@@ -387,11 +390,21 @@ module.exports = {
387390
{
388391
continuation = true;
389392
}
393+
394+
var ts0 = this.state.room.timeline[i - 1].getTs();
395+
var ts1 = this.state.room.timeline[i].getTs();
396+
if (new Date(ts0).toDateString() !== new Date(ts1).toDateString()) {
397+
dateSeparator = <DateSeparator key={ts1} ts={ts1}/>;
398+
continuation = false;
399+
}
390400
}
391401
if (!TileType) continue;
392402
ret.unshift(
393403
<li key={mxEv.getId()}><TileType mxEvent={mxEv} continuation={continuation} last={last}/></li>
394404
);
405+
if (dateSeparator) {
406+
ret.unshift(dateSeparator);
407+
}
395408
++count;
396409
}
397410
return ret;

0 commit comments

Comments
 (0)