diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-10-07 11:11:07 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-10-07 11:11:07 +0200 |
commit | a4524cd9afd5446d2f1e8a5bcdb88217e864fde5 (patch) | |
tree | 8434bea6eadace52d013d52c898d788d7157c01c | |
parent | Add a shortcut for search (diff) | |
download | nheko-a4524cd9afd5446d2f1e8a5bcdb88217e864fde5.tar.xz |
Fix date separator
-rw-r--r-- | resources/qml/MessageView.qml | 14 | ||||
-rw-r--r-- | src/timeline/TimelineModel.cpp | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index 202c3e3d..f94fc4a9 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -406,7 +406,7 @@ Item { required property bool isEditable required property bool isEdited required property bool isStateEvent - property bool previousMessageIsStateEvent: chat.model.dataByIndex(index+1, Room.IsStateEvent) + property bool previousMessageIsStateEvent: (index + 1) >= chat.count ? true : chat.model.dataByIndex(index+1, Room.IsStateEvent) required property string replyTo required property string threadId required property string userId @@ -420,9 +420,9 @@ Item { required property int status required property int index required property int relatedEventCacheBuster - required property string day - property string previousMessageUserId: chat.model.dataByIndex(index+1, Room.UserId) - property string previousMessageDay: chat.model.dataByIndex(index+1, Room.Day) + required property var day + property string previousMessageUserId: (index + 1) >= chat.count ? "" : chat.model.dataByIndex(index+1, Room.UserId) + property var previousMessageDay: (index + 1) >= chat.count ? 0 : chat.model.dataByIndex(index+1, Room.Day) required property string userName property bool scrolledToThis: eventId === room.scrollTarget && (y + height > chat.y + chat.contentY && y < chat.y + chat.height + chat.contentY) @@ -436,8 +436,8 @@ Item { property int parentWidth: parent.width property string userId: wrapper.userId property string previousMessageUserId: wrapper.previousMessageUserId - property string day: wrapper.day - property string previousMessageDay: wrapper.previousMessageDay + property var day: wrapper.day + property var previousMessageDay: wrapper.previousMessageDay property bool previousMessageIsStateEvent: wrapper.previousMessageIsStateEvent property bool isStateEvent: wrapper.isStateEvent property bool isSender: wrapper.isSender @@ -445,7 +445,7 @@ Item { property date timestamp: wrapper.timestamp z: 4 - active: previousMessageUserId !== undefined && previousMessageUserId !== userId || previousMessageDay !== day || previousMessageIsStateEvent !== isStateEvent + active: previousMessageUserId !== userId || previousMessageDay !== day || previousMessageIsStateEvent !== isStateEvent //asynchronous: true sourceComponent: sectionHeader visible: status == Loader.Ready diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index 3ce854a4..0eec5cae 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -549,7 +549,7 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r case Day: { QDateTime prevDate = origin_server_ts(event); prevDate.setTime(QTime()); - return {prevDate.toMSecsSinceEpoch()}; + return QVariant(prevDate.toMSecsSinceEpoch()); } case Timestamp: return QVariant(origin_server_ts(event)); |