From 7554a393795bf5a1d4fe08ac58bb42f00461beac Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Mon, 7 Sep 2026 22:29:51 +0700 Subject: [PATCH] Shops: preserve unmanaged tags on edit + drop debug log (1.2.31) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit EditShopPage rebuilt a shop's tag set from scratch on save. A shop (NIP-15 stall, kind 30017) is addressable, so re-publishing REPLACES all tags — any tag the form doesn't manage would be dropped. The app's own SkateShop parser only reads the managed fields today (so no current in-app data loss), but a stall created/edited in another Nostr client can legitimately carry currency, shipping, or other NIP-15 tags that would vanish on the first SkateSpots edit. Applied the same "preserve unmanaged tags" passthrough used for event edits: keep every non-managed tag untouched, with `t` handled specially (form owns the 'skateshop' marker, foreign topics preserved). Also removed a leftover console.log of the full shop event payload in CreateShopPage (matching the earlier spot-form cleanup). Audit note (no change needed): ShopDetailPage already provides full owner management — an Edit link and an owner/admin Delete with confirmation via useDeleteEntity — so unlike the marketplace listings fixed in 1.2.30, shops were never missing a management path. Co-authored-by: shakespeare.diy --- package.json | 2 +- src/pages/CreateShopPage.tsx | 6 ------ src/pages/EditShopPage.tsx | 20 ++++++++++++++++++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index a00873c..7ba1032 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "skate-spots", "private": true, - "version": "1.2.30", + "version": "1.2.31", "type": "module", "homepage": "https://skate-spots.com", "scripts": { diff --git a/src/pages/CreateShopPage.tsx b/src/pages/CreateShopPage.tsx index ee1ac4c..4893b55 100644 --- a/src/pages/CreateShopPage.tsx +++ b/src/pages/CreateShopPage.tsx @@ -220,12 +220,6 @@ export default function CreateShopPage() { tags.push(['imeta', `url ${imageUrl}`, 'm image/jpeg']); } - console.log('Publishing shop event:', { - kind: SKATE_SHOP_KIND, - tags, - content: description.trim() - }); - await createEvent({ kind: SKATE_SHOP_KIND, content: description.trim(), diff --git a/src/pages/EditShopPage.tsx b/src/pages/EditShopPage.tsx index ebd6af6..d72e465 100644 --- a/src/pages/EditShopPage.tsx +++ b/src/pages/EditShopPage.tsx @@ -263,6 +263,26 @@ export default function EditShopPage() { tags.push(['imeta', `url ${imageUrl}`, 'm image/jpeg']); } + // Carry through any tag this form doesn't manage, untouched. A shop is an + // addressable NIP-15 stall, so re-publishing REPLACES the whole tag set — + // rebuilding only the fields on this form would silently strip anything + // else the stall carries (e.g. currency/shipping from another client, or + // future tags), just like the event-edit fix. `t` is special: this form + // owns the 'skateshop' marker, so keep every OTHER topic tag. + const MANAGED_TAGS = new Set([ + 'd', 'name', 'g', 'lat', 'lon', 'location', 'alt', + 'phone', 'email', 'website', 'instagram', 'hours', 'noffer', 'imeta', + ]); + for (const tag of shop.event.tags) { + const [tagName, tagValue] = tag; + if (MANAGED_TAGS.has(tagName)) continue; + if (tagName === 't') { + if (tagValue !== 'skateshop') tags.push(tag); // keep foreign topics + continue; + } + tags.push(tag); + } + await createEvent({ kind: SKATE_SHOP_KIND, content: description.trim(),