git » sdk » commit 6f3c089

Persist block even if already closed

author Stephen Paul Weber
2024-11-12 04:33:20 UTC
committer Stephen Paul Weber
2024-11-12 04:33:20 UTC
parent d3508118a04c74ac03aca7dbcd5278b4261e0821

Persist block even if already closed

snikket/Chat.hx +5 -1

diff --git a/snikket/Chat.hx b/snikket/Chat.hx
index 3a22dd5..a82ec98 100644
--- a/snikket/Chat.hx
+++ b/snikket/Chat.hx
@@ -290,7 +290,11 @@ abstract class Chat {
 	public function block(reportSpam: Null<ChatMessage>, onServer: Bool): Void {
 		if (reportSpam != null && !onServer) throw "Can't report SPAM if not sending to server";
 		isBlocked = true;
-		if (uiState != Closed) close(); // close persists
+		if (uiState == Closed) {
+			persistence.storeChat(client.accountId(), this);
+		} else {
+			close(); // close persists
+		}
 		if (onServer) {
 			final iq = new Stanza("iq", { type: "set", id: ID.short() })
 				.tag("block", { xmlns: "urn:xmpp:blocking" })