From bc10d7184ff63e2c60cae259373cd478cbcfcc50 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 12 Sep 2025 11:37:58 -0400 Subject: [PATCH] Fixes mark as read when drafts are the latest message in the chat --- .../amethyst/ui/screen/loggedIn/AccountViewModel.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index 896f98841..87f3ba2f6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -1084,6 +1084,13 @@ class AccountViewModel( account.markAsRead("Channel/${noteEvent.channelId()}", noteEvent.createdAt) } else if (noteEvent is ChatroomKeyable) { account.markAsRead("Room/${noteEvent.chatroomKey(account.signer.pubKey).hashCode()}", noteEvent.createdAt) + } else if (noteEvent is DraftWrapEvent) { + val innerEvent = account.draftsDecryptionCache.preCachedDraft(noteEvent) + if (innerEvent is IsInPublicChatChannel) { + account.markAsRead("Channel/${innerEvent.channelId()}", noteEvent.createdAt) + } else if (innerEvent is ChatroomKeyable) { + account.markAsRead("Room/${innerEvent.chatroomKey(account.signer.pubKey).hashCode()}", noteEvent.createdAt) + } } } }