Switch to using dateSent for jump-to-calendar.

We use dateSent for date dividers, but were using dateReceived for
calendar date availability, which would occasionally result in a
mismatch. Switched to use the same thing we use for date dividers.
This commit is contained in:
Greyson Parrelli
2024-05-17 12:43:34 -04:00
committed by Cody Henthorne
parent 6f2cce1494
commit 2744dec43a
4 changed files with 9 additions and 9 deletions

View File

@@ -3954,17 +3954,17 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
return dayStarts.associateWith { startOfDay ->
readableDatabase
.exists(TABLE_NAME)
.where("$THREAD_ID = $threadId AND $DATE_RECEIVED >= $startOfDay AND $DATE_RECEIVED < $startOfDay + 86400000 AND $SCHEDULED_DATE = -1 AND $LATEST_REVISION_ID IS NULL AND $STORY_TYPE = 0 AND $PARENT_STORY_ID <= 0")
.where("$THREAD_ID = $threadId AND $DATE_SENT >= $startOfDay AND $DATE_SENT < $startOfDay + 86400000 AND $SCHEDULED_DATE = -1 AND $LATEST_REVISION_ID IS NULL AND $STORY_TYPE = 0 AND $PARENT_STORY_ID <= 0")
.run()
}
}
fun getEarliestMessageDate(threadId: Long): Long {
fun getEarliestMessageSentDate(threadId: Long): Long {
return readableDatabase
.select(DATE_RECEIVED)
.select(DATE_SENT)
.from(TABLE_NAME)
.where("$THREAD_ID = $threadId AND $SCHEDULED_DATE = -1 AND $LATEST_REVISION_ID IS NULL AND $STORY_TYPE = 0 AND $PARENT_STORY_ID <= 0")
.orderBy("$DATE_RECEIVED ASC")
.orderBy("$DATE_SENT ASC")
.limit(1)
.run()
.readToSingleLong(0)