diff --git a/js/services/moderationService.js b/js/services/moderationService.js index 3e0e5ad5..559518d5 100644 --- a/js/services/moderationService.js +++ b/js/services/moderationService.js @@ -636,6 +636,7 @@ export class ModerationService { } setTrustedSeeds(seeds = []) { + this.log("[moderationService] setTrustedSeeds called", { count: seeds?.length || seeds?.size || 0 }); const sanitizedSeeds = new Set(); const adminSnapshot = this.getAdminListSnapshot(); const blacklistHex = adminSnapshot.blacklistHex; @@ -867,6 +868,11 @@ export class ModerationService { const previous = previousSet instanceof Set ? new Set(previousSet) : new Set(); const next = nextSet instanceof Set ? new Set(nextSet) : new Set(); + this.log("[moderationService] reconcileTrustedMuteSubscriptions", { + previous: previous.size, + next: next.size, + }); + if (this.viewerPubkey) { if (this.trustedMuteSubscriptions.has(this.viewerPubkey)) { previous.add(this.viewerPubkey); @@ -881,14 +887,12 @@ export class ModerationService { } for (const value of next) { - if (!previous.has(value)) { - this.subscribeToTrustedMuteList(value).catch((error) => { - this.log( - `(moderationService) failed to subscribe to trusted mute list for ${value}`, - error, - ); - }); - } + this.subscribeToTrustedMuteList(value).catch((error) => { + this.log( + `(moderationService) failed to subscribe to trusted mute list for ${value}`, + error, + ); + }); } } @@ -927,9 +931,12 @@ export class ModerationService { } return; } else if (typeof record.unsub === "function") { + this.log(`[moderationService] already subscribed to ${normalized}`); return; } + this.log(`[moderationService] subscribing to trusted mute list for ${normalized}`); + record.promise = (async () => { try { await this.ensurePool(); @@ -947,6 +954,7 @@ export class ModerationService { const relays = resolveRelayList(this.nostrClient); if (!relays.length) { + this.log(`[moderationService] no relays available for ${normalized}`); return; } @@ -991,6 +999,7 @@ export class ModerationService { }); sub.on("eose", () => {}); record.unsub = typeof sub.unsub === "function" ? () => sub.unsub() : null; + this.log(`[moderationService] subscribed to trusted mute list for ${normalized}`); } catch (error) { this.log( `(moderationService) failed to subscribe to trusted mute list for ${normalized}`, @@ -1153,6 +1162,7 @@ export class ModerationService { return; } + this.log(`[moderationService] ingesting trusted mute event from ${owner} (${event.id})`); this.applyTrustedMuteEvent(owner, event); }