From 0a7f9349a9bca33db968ba99667301902e7f2518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Simon=20Fauteux-Chapleau?= <francois-simon.fauteux-chapleau@savoirfairelinux.com> Date: Thu, 11 Jul 2024 13:57:22 -0400 Subject: [PATCH] smartlist: don't display misleading 'last interaction' date If a conversation has no interactions (which shouldn't happen normally, but sometimes occurs in practice), then its LastInteractionTimeStamp will be zero, which causes the last interaction date in the smartlist to be wrongly displayed as 31/12/1969 or 1/1/1970. This patch adds a check to prevent this. GitLab: #1794 Change-Id: I1384d6675c9fcaa1904bb6e1706589305b7618e9 --- src/app/mainview/components/SmartListItemDelegate.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/mainview/components/SmartListItemDelegate.qml b/src/app/mainview/components/SmartListItemDelegate.qml index 299595b88..dc07dcad9 100644 --- a/src/app/mainview/components/SmartListItemDelegate.qml +++ b/src/app/mainview/components/SmartListItemDelegate.qml @@ -38,9 +38,9 @@ ItemDelegate { highlighted: ListView.isCurrentItem property bool interactive: true - property string lastInteractionDate: LastInteractionTimeStamp === undefined ? "" : LastInteractionTimeStamp - property string lastInteractionFormattedDate: MessagesAdapter.getBestFormattedDate(lastInteractionDate) + property int lastInteractionTimeStamp: LastInteractionTimeStamp + property string lastInteractionFormattedDate: MessagesAdapter.getBestFormattedDate(lastInteractionTimeStamp) property bool showSharePositionIndicator: PositionManager.isPositionSharedToConv(accountId, UID) property bool showSharedPositionIndicator: PositionManager.isConvSharingPosition(accountId, UID) @@ -58,7 +58,7 @@ ItemDelegate { Connections { target: MessagesAdapter function onTimestampUpdated() { - lastInteractionFormattedDate = MessagesAdapter.getBestFormattedDate(lastInteractionDate); + lastInteractionFormattedDate = MessagesAdapter.getBestFormattedDate(lastInteractionTimeStamp); } } @@ -130,7 +130,7 @@ ItemDelegate { color: JamiTheme.textColor } RowLayout { - visible: ContactType !== Profile.Type.TEMPORARY && !IsBanned && lastInteractionFormattedDate !== undefined && interactive + visible: ContactType !== Profile.Type.TEMPORARY && !IsBanned && lastInteractionTimeStamp > 0 && interactive Layout.fillWidth: true Layout.minimumHeight: 20 Layout.alignment: Qt.AlignTop @@ -138,7 +138,7 @@ ItemDelegate { // last Interaction date Text { Layout.alignment: Qt.AlignVCenter - text: lastInteractionFormattedDate === undefined ? "" : lastInteractionFormattedDate + text: lastInteractionFormattedDate textFormat: TextEdit.PlainText font.pointSize: JamiTheme.smallFontSize font.weight: UnreadMessagesCount ? Font.DemiBold : Font.Normal -- GitLab