From f0612c2a518ba71c21a0e7c130900841690adb26 Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 30 Aug 2019 10:33:17 -0400 Subject: [PATCH] Fix daybreak not showing before RoomCreateEvent --- TODO.md | 1 - src/qml/Chat/Timeline/EventList.qml | 17 ++++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/TODO.md b/TODO.md index c21f58fb..8d8f2501 100644 --- a/TODO.md +++ b/TODO.md @@ -11,7 +11,6 @@ - When qml syntax highlighting supports ES6 string interpolation, use them - Fixes - - Daybreak? - Collapsing last account with shortcut when focused on room - Using up/down when sidepane focused - Missing hourglass when changing avatar and applying diff --git a/src/qml/Chat/Timeline/EventList.qml b/src/qml/Chat/Timeline/EventList.qml index ec5ef3af..69ec24a3 100644 --- a/src/qml/Chat/Timeline/EventList.qml +++ b/src/qml/Chat/Timeline/EventList.qml @@ -13,7 +13,7 @@ Rectangle { Component.onCompleted: shortcuts.flickTarget = eventList function canCombine(item, itemAfter) { - if (! item || ! itemAfter) { return false } + if (! item || ! itemAfter) return false return Boolean( ! canTalkBreak(item, itemAfter) && @@ -24,7 +24,7 @@ Rectangle { } function canTalkBreak(item, itemAfter) { - if (! item || ! itemAfter) { return false } + if (! item || ! itemAfter) return false return Boolean( ! canDayBreak(item, itemAfter) && @@ -33,14 +33,13 @@ Rectangle { } function canDayBreak(item, itemAfter) { - if (! item || ! itemAfter || ! item.date || ! itemAfter.date) { - return false - } + if (itemAfter && itemAfter.event_type == "RoomCreateEvent") + return true - return Boolean( - itemAfter.event_type == "RoomCreateEvent" || - item.date.getDate() != itemAfter.date.getDate() - ) + if (! item || ! itemAfter || ! item.date || ! itemAfter.date) + return false + + return item.date.getDate() != itemAfter.date.getDate() } model: HListModel {