Handle all kind 0 display-name variants in the Nostr profile editor #270

Merged
raucao merged 1 commits from feature/nostr-profile-display-name-variants into master 2026-11-19 11:18:33 +00:00
Owner

The Nostr profile editor only handled display_name/displayName on read and wrote just display_name on save (deleting displayName), so profiles that use name or the deprecated aliases were displayed and updated incorrectly.

This reads the first present of display_name, displayName, name and username (NIP-01/NIP-24 priority) with a fallback to the account display name, and writes the edited value to every variant for maximum client compatibility. The ordered key list is defined once in NostrManagerService::DISPLAY_NAME_KEYS and passed to the Stimulus controller, so the Ruby and JS sides can't drift.

Changes:

  • NostrManagerService::DISPLAY_NAME_KEYS constant.
  • Read-side fallback chain in NostrEditProfileComponent.
  • Write-side loop over all keys in nostr_profile_editor_controller.js.
  • Component spec coverage for the fallback chain.
  • Documentation note in docs/dev/nostr.md.

No server-side merge is involved: the browser builds the kind 0 content JSON and the controller accepts it as-is.

Tested with spec/components/settings/nostr_edit_profile_component_spec.rb (16 examples, 0 failures).

The Nostr profile editor only handled `display_name`/`displayName` on read and wrote just `display_name` on save (deleting `displayName`), so profiles that use `name` or the deprecated aliases were displayed and updated incorrectly. This reads the first present of `display_name`, `displayName`, `name` and `username` (NIP-01/NIP-24 priority) with a fallback to the account display name, and writes the edited value to every variant for maximum client compatibility. The ordered key list is defined once in `NostrManagerService::DISPLAY_NAME_KEYS` and passed to the Stimulus controller, so the Ruby and JS sides can't drift. Changes: - `NostrManagerService::DISPLAY_NAME_KEYS` constant. - Read-side fallback chain in `NostrEditProfileComponent`. - Write-side loop over all keys in `nostr_profile_editor_controller.js`. - Component spec coverage for the fallback chain. - Documentation note in `docs/dev/nostr.md`. No server-side merge is involved: the browser builds the kind 0 content JSON and the controller accepts it as-is. Tested with `spec/components/settings/nostr_edit_profile_component_spec.rb` (16 examples, 0 failures).
raucao added 1 commit 2026-11-19 11:14:50 +00:00
Handle all kind 0 display-name variants in the Nostr profile editor
CI / Test (pull_request) Successful in 51s
Release Drafter / Update release notes draft (pull_request) Successful in 6s
c1826a46f4
The editor read only `display_name`/`displayName` and wrote just `display_name` (deleting `displayName`), so profiles using `name` or the deprecated aliases were shown and updated incorrectly.

Read the first present of `display_name`, `displayName`, `name` and `username` (NIP-01/NIP-24 priority) with a fallback to the account display name, and write the edited value to every variant. The key list lives in `NostrManagerService::DISPLAY_NAME_KEYS` and is passed to the Stimulus controller so Ruby and JS stay in sync.
raucao added the
integration
nostr
enhancement
labels 2026-11-19 11:16:23 +00:00
raucao added the kredits-1 label 2026-11-19 11:18:26 +00:00
raucao merged commit 12c99c9d5a into master 2026-11-19 11:18:33 +00:00
raucao deleted branch feature/nostr-profile-display-name-variants 2026-11-19 11:18:34 +00:00
Sign in to join this conversation.