From d45b115f073add770dc1d3e992283033099c156d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 4 Feb 2026 16:16:15 +0000 Subject: [PATCH] Fix annoying DM relay warning and clarify settings UI - Throttle the "Privacy warning: direct messages are using your default relays..." message so it only appears once per session/identity change. - Rename "DM Relay Hints" to "NIP-17 Relay List" in the DM Settings modal to match the warning message and reduce user confusion. - Add regression test for the warning throttling logic. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- components/dm-settings-modal.html | 10 +++++----- js/ui/profileModalController.js | 7 +++++++ tests/profile-modal-controller.test.mjs | 23 +++++++++++++++++++++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/components/dm-settings-modal.html b/components/dm-settings-modal.html index c442e3fe..4de6b779 100644 --- a/components/dm-settings-modal.html +++ b/components/dm-settings-modal.html @@ -62,16 +62,16 @@
-

DM Relay Hints

+

NIP-17 Relay List

- Publish relay hints for direct messages as kind:10050 events. Use WSS-only relay URLs so encrypted DM delivery stays secure. + Publish your NIP-17 relay list for direct messages as kind:10050 events. Use WSS-only relay URLs so encrypted DM delivery stays secure.

- +
diff --git a/js/ui/profileModalController.js b/js/ui/profileModalController.js index 6939d687..cc07eebf 100644 --- a/js/ui/profileModalController.js +++ b/js/ui/profileModalController.js @@ -1042,6 +1042,7 @@ export class ProfileModalController { this.adminSuperNpub = resolvedAdminSuperNpub; this.adminDmImageUrl = resolvedAdminDmImageUrl; this.bitvidWebsiteUrl = resolvedbitvidWebsiteUrl; + this.hasShownRelayWarning = false; this.internalState = { savedProfiles: [], @@ -2795,6 +2796,7 @@ export class ProfileModalController { ? this.normalizeHexPubkey(actorPubkey) : this.resolveActiveDmActor(); + this.hasShownRelayWarning = false; this.setDirectMessageRecipient(null, { reason: "clear" }); this.resetAttachmentQueue({ clearInput: true }); this.dmReadReceiptCache.clear(); @@ -5374,6 +5376,11 @@ export class ProfileModalController { return; } + if (this.hasShownRelayWarning) { + return; + } + this.hasShownRelayWarning = true; + this.showStatus( "Privacy warning: direct messages are using your default relays because no NIP-17 relay list is available.", { autoHideMs: 5000 }, diff --git a/tests/profile-modal-controller.test.mjs b/tests/profile-modal-controller.test.mjs index 3bcc27d8..8e825092 100644 --- a/tests/profile-modal-controller.test.mjs +++ b/tests/profile-modal-controller.test.mjs @@ -1307,3 +1307,26 @@ test('history pane lazily initializes the watch history renderer', async () => { assert.equal(controller.profileHistoryRenderer, null); assert.equal(controller.boundProfileHistoryVisibility, null); }); + +test('handleDirectMessagesRelayWarning throttles status updates', async (t) => { + const statusCalls = []; + const controller = createController({ + showStatus: (message) => statusCalls.push(message), + }); + await controller.load(); + + const detail = { warning: 'dm-relays-fallback' }; + + controller.handleDirectMessagesRelayWarning(detail); + assert.equal(statusCalls.length, 1); + assert.match(statusCalls[0], /Privacy warning/); + + // Second call should be suppressed + controller.handleDirectMessagesRelayWarning(detail); + assert.equal(statusCalls.length, 1); + + // Reset should allow it again + controller.handleActiveDmIdentityChanged('newpubkey'); + controller.handleDirectMessagesRelayWarning(detail); + assert.equal(statusCalls.length, 2); +});