git » sdk » commit 6211e6c

dedup participants

author Stephen Paul Weber
2025-09-10 19:58:49 UTC
committer Stephen Paul Weber
2025-09-10 19:58:49 UTC
parent 17693f145cdd6acc76cf6dfc0fef825f2a3f17a5

dedup participants

snikket/Chat.hx +10 -2

diff --git a/snikket/Chat.hx b/snikket/Chat.hx
index 1e43d1d..39ad73a 100644
--- a/snikket/Chat.hx
+++ b/snikket/Chat.hx
@@ -730,11 +730,19 @@ class DirectChat extends Chat {
 	@HaxeCBridge.noemit // on superclass as abstract
 	public function getParticipants(): Array<String> {
 		final counters = counterparts();
+		final ids: Map<String, Bool> = [];
 		if (counters.length < 2 && (lastMessage?.recipients?.length ?? 0) > 1) {
-			return lastMessage.recipients.map(r -> r.asString()).concat([lastMessage.senderId]);
+			ids[lastMessage.senderId] = true;
+			for (id in lastMessage.recipients.map(r -> r.asString())) {
+				ids[id] = true;
+			}
 		} else {
-			return counterparts().concat([client.accountId()]);
+			ids[client.accountId()] = true;
+			for (id in counterparts()) {
+				ids[id] = true;
+			}
 		}
+		return { iterator: () -> ids.keys() }.array();
 	}
 
 	private function counterparts() {