Fix draft being sorted at the bottom

In some cases, if no date was set, it would get sorted to the bottom
This commit is contained in:
Inhishonor
2025-08-02 13:05:41 -07:00
parent 394c2f9b3a
commit 5f5a92faac
3 changed files with 10 additions and 6 deletions
@@ -31,6 +31,7 @@ open class Conversation(
var recipients: RealmList<Recipient> = RealmList(),
var lastMessage: Message? = null,
var draft: String = "",
var draftDate: Long = 0,
var blockingClient: Int? = null,
var blockReason: String? = null,
@@ -38,7 +39,7 @@ open class Conversation(
var name: String = "" // For group chats, the user is allowed to set a custom title for the conversation
) : RealmObject() {
val date: Long get() = lastMessage?.date ?: 0
val date: Long get() = lastMessage?.date ?: if (draft.isNotEmpty()) draftDate else 0
val snippet: String? get() = lastMessage?.getSummary()
val unread: Boolean get() = lastMessage?.read == false
val me: Boolean get() = lastMessage?.isMe() == true