Skip to content
Snippets Groups Projects
Commit 0a7f9349 authored by François-Simon Fauteux-Chapleau's avatar François-Simon Fauteux-Chapleau Committed by Adrien Béraud
Browse files

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
parent 99254f8d
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment