diff options
| author | Adam Soltys <[email protected]> | 2026-10-11 22:30:10 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-11 22:30:10 -0700 |
| commit | 8b65caee4348073f44c36d379bc654c27f5e9ee5 (patch) | |
| tree | d21c03cf877689d39c7fc0be263afe46b751fb1d /src/features/messages.js | |
| parent | 4f49202c80662e617c9d666928b7e40df37cb9b8 (diff) | |
| download | coinosv3-8b65caee4348073f44c36d379bc654c27f5e9ee5.tar.gz coinosv3-8b65caee4348073f44c36d379bc654c27f5e9ee5.zip | |
Feed: ⚡ on a locked wallet says so and opens the Accounts page. A locked wallet — the watch-only view of a sealed vault, or a nostr identity signed in over one (Adam's debug Chrome: three watch-only accounts, the vault gone, his extension identity on the first) — has no keys to pay with, and the zap button knew it: it got no handler at all, so the tap pressed the icon and nothing more, under an arrow cursor. Now the tap toasts "Your wallet is locked, so it can't zap. Unlock it to send sats." and opens the Accounts page, where the padlock and Add account are; the open feed is remembered for the way back (by URL, or by id for Following, which has none — returnAfterSignin learns the id form). tools/zap-locked-test.js.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Diffstat (limited to 'src/features/messages.js')
| -rw-r--r-- | src/features/messages.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index 3bccd31..64e36c5 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -8385,6 +8385,21 @@ export function messagesFeature(ctx) { // Your own posts and messages too: a zap to yourself is a harmless // round-trip, and one bar that behaves the same everywhere beats a special case. const canZapPk = (pk) => !!pk && !isVisitor() && !!(hook('arkReady') || hook('canLnZap')); // a visitor's tap asks them in instead + // A locked wallet — the watch-only view of a sealed vault, or an identity + // signed in over one — has no keys to pay with. The tap says so and opens + // the Accounts page (the padlock, and the way to add the wallet, are + // there); the feed is remembered for the way back. It used to do nothing + // at all: the button pressed, the cursor an arrow. + function zapLockedAsk() { + toast('\u{1F512} ' + t('zapLocked'), 4000); + // the open feed, for the way back: by its URL when it has one, by its + // id otherwise (Following lives at no address) + const def = ui.chatOpen && ui.msgView === 'feed' ? feedDef() : null; + const back = def ? feedPath(def) || 'feed:' + def.id : null; + try { sessionStorage.setItem(RETURN_KEY, back || location.pathname + location.search); } catch {} + ui.screen = 'accounts'; + render(); + } function zapNote(pk, ev, origin) { const npubStr = npubOf(pk); const def = ctx.zapDefaultSat ? ctx.zapDefaultSat() : 0; @@ -9594,7 +9609,7 @@ export function messagesFeature(ctx) { // always in the bar — the same row of buttons on every post, so nothing // shifts when a wallet comes online; without one it is just the number btn(I_ZAP, zapLabel, zapSats ? fmtSats(zapSats) : 0, zapMine, - (zapHold && zapHold.onClick) || (isVisitor() ? () => signinAsk() : null), + (zapHold && zapHold.onClick) || (isVisitor() ? () => signinAsk() : wallet.watchOnly ? zapLockedAsk : null), 'note-zap' + (zapMine ? ' zapped' : '') + (zapFlying ? ' flying' : ''), zapHold && { ...zapHold, onClick: undefined }), // who did all that: a small chevron, always in place — dimmed until @@ -11068,6 +11083,7 @@ export function messagesFeature(ctx) { if (!back) return; setTimeout(() => { try { + if (back.startsWith('feed:')) { showFeed(back.slice(5)); render(); return; } const [path, q] = back.split('?'); if (/^\/feed(\/|$)/i.test(path)) { openFeedUrl(path.replace(/^\/feed\/?/i, ''), q ? '?' + q : ''); return; } const pk = parseNostrPubkey(path.replace(/^\//, '')); |
