Copy photo event IDs reliably, add "Copy share link" #138

Merged
raucao merged 3 commits from copy-photo-id into master 2026-11-29 13:35:07 +00:00
Owner

The photo gallery's action menu now copies through the shared clipboard helper, no longer closes the gallery, and gains a "Copy share link" item.

Copying called navigator.clipboard.writeText directly, which is unavailable on insecure origins (for example a LAN dev server over plain http), so it failed there. It now goes through copyText from app/utils/share.js, which falls back to execCommand. The invoice and connection-link copy paths use the same helper now.

Copying the event ID also left the click free to bubble to the overlay's background-click handler. Because closeMenu() runs after an await, the dropdown had already unmounted by the time the event reached the handler, its detached-target check failed and the gallery closed. copyEventId now stops propagation synchronously, like the zap and delete actions.

The new "Copy share link" item copies an absolute <origin>/e/<nevent> link. The existing /e/ route resolves the event from relays, reads its i tag and opens the place with the photo focused, so recipients land directly on the photo in Marco. Both copy actions share one buildEventReference() helper, and the menu labels use sentence case.

The photo gallery's action menu now copies through the shared clipboard helper, no longer closes the gallery, and gains a "Copy share link" item. Copying called `navigator.clipboard.writeText` directly, which is unavailable on insecure origins (for example a LAN dev server over plain http), so it failed there. It now goes through `copyText` from `app/utils/share.js`, which falls back to `execCommand`. The invoice and connection-link copy paths use the same helper now. Copying the event ID also left the click free to bubble to the overlay's background-click handler. Because `closeMenu()` runs after an `await`, the dropdown had already unmounted by the time the event reached the handler, its detached-target check failed and the gallery closed. `copyEventId` now stops propagation synchronously, like the zap and delete actions. The new "Copy share link" item copies an absolute `<origin>/e/<nevent>` link. The existing `/e/` route resolves the event from relays, reads its `i` tag and opens the place with the photo focused, so recipients land directly on the photo in Marco. Both copy actions share one `buildEventReference()` helper, and the menu labels use sentence case.
raucao added 2 commits 2026-11-29 13:27:28 +00:00
The photo event ID button called navigator.clipboard.writeText directly, so copying failed on insecure origins where that API is unavailable. Route it (and the invoice and connection-link copies) through app/utils/share.js copyText, which falls back to execCommand.

copyEventId also never stopped the click from bubbling. Because closeMenu() runs after an await, the dropdown unmounted before the event reached the overlay's background-click handler, whose detached-target check then closed the gallery. Stop propagation synchronously like the zap and delete actions.
Add a Copy share link action to the photo gallery
CI / Lint (pull_request) Successful in 48s
CI / Test (pull_request) Successful in 1m10s
47830f7224
The new menu item copies an absolute <origin>/e/<nevent> link. The /e/ route resolves the event from relays, reads its i tag and opens the place with the photo focused, so recipients land directly on the photo in Marco.

Extract the nevent-building logic into buildEventReference() so the raw event ID copy and the share link share one implementation, and use sentence case for the menu labels.
raucao added the enhancementfeaturenostr labels 2026-11-29 13:31:12 +00:00
raucao changed title from Copy photo event IDs and share links reliably to Copy photo event IDs reliably, add "Copy share link" 2026-11-29 13:31:40 +00:00
raucao added 1 commit 2026-11-29 13:31:47 +00:00
Remove the unused canUseClipboard helper
CI / Lint (pull_request) Successful in 55s
CI / Test (pull_request) Successful in 1m22s
Release Drafter / Update release notes draft (pull_request) Successful in 15s
543d810ab2
canCopyText covers the same capability checks and is the one the app actually uses.
raucao merged commit 36bfc54e6c into master 2026-11-29 13:35:07 +00:00
raucao deleted branch copy-photo-id 2026-11-29 13:35:07 +00:00
Sign in to join this conversation.