Shops: preserve unmanaged tags on edit + drop debug log (1.2.31)
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 <assistant@shakespeare.diy>
This commit is contained in:
parent
080785a8c5
commit
7554a39379
3 changed files with 21 additions and 7 deletions
|
|
@ -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": {
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue