git » sdk » commit 4ee5790

No need to fetch existing read message when there is none

author Stephen Paul Weber
2025-03-26 18:23:53 UTC
committer Stephen Paul Weber
2025-03-26 18:23:53 UTC
parent 42c9c834c533bc00d018bf2c3e35113368b7d61d

No need to fetch existing read message when there is none

snikket/Chat.hx +5 -0

diff --git a/snikket/Chat.hx b/snikket/Chat.hx
index 9dd5b7d..ff01b56 100644
--- a/snikket/Chat.hx
+++ b/snikket/Chat.hx
@@ -642,6 +642,11 @@ abstract class Chat {
 		if (message.serverId == null || message.chatId() != chatId) return;
 		if (readUpTo() == message.serverId) return;
 
+		if (readUpTo() == null) {
+			markReadUpToId(message.serverId, message.serverIdBy, callback);
+			return;
+		}
+
 		persistence.getMessage(client.accountId(), chatId, readUpTo(), null, (readMessage) -> {
 			if (readMessage != null && Reflect.compare(message.timestamp, readMessage.timestamp) <= 0) return;