git » sdk » commit 1f4fa92

Don't update push and client when just loading from DB

author Stephen Paul Weber
2025-06-24 17:47:39 UTC
committer Stephen Paul Weber
2025-06-24 17:47:39 UTC
parent 8054dd1ff5608ae93cc1311b5c36373e4c10438c

Don't update push and client when just loading from DB

snikket/Chat.hx +11 -5

diff --git a/snikket/Chat.hx b/snikket/Chat.hx
index daa85be..2ddb330 100644
--- a/snikket/Chat.hx
+++ b/snikket/Chat.hx
@@ -340,16 +340,22 @@ abstract class Chat {
 		}
 	}
 
-	/**
-		Update notification preferences
-	**/
-	public function setNotifications(filtered: Bool, mention: Bool, reply: Bool) {
+	@:allow(snikket)
+	private function setNotificationsInternal(filtered: Bool, mention: Bool, reply: Bool) {
 		if (filtered) {
 			notificationSettings = { mention: mention, reply: reply };
 		} else {
 			notificationSettings = null;
 		}
+	}
+
+	/**
+		Update notification preferences
+	**/
+	public function setNotifications(filtered: Bool, mention: Bool, reply: Bool) {
+		setNotificationsInternal(filtered, mention, reply);
 		persistence.storeChats(client.accountId(), [this]);
+		client.trigger("chats/update", [this]);
 		client.updatePushIfEnabled();
 	}
 
@@ -1602,7 +1608,7 @@ class SerializedChat {
 		} else {
 			throw "Unknown class of " + chatId + ": " + klass;
 		}
-		chat.setNotifications(filterN, mention, notifyReply);
+		chat.setNotificationsInternal(filterN, mention, notifyReply);
 		if (displayName != null) chat.displayName = displayName;
 		if (avatarSha1 != null) chat.setAvatarSha1(avatarSha1);
 		chat.setTrusted(trusted);