fix(stats): validate kind-30017 with parseSkateShop so foreign shops leave Top Shops

This commit is contained in:
SkateSpots 2026-10-05 20:00:44 +07:00
parent a9dcb5719c
commit 04774bc180

View file

@ -3,6 +3,7 @@ import { useSkateRelays } from '@/hooks/useSkateRelays';
import { import {
SKATE_SPOT_KIND, SKATE_SPOT_KIND,
SKATE_SHOP_KIND, SKATE_SHOP_KIND,
parseSkateShop,
CALENDAR_EVENT_KIND, CALENDAR_EVENT_KIND,
SKATE_COACH_KIND, SKATE_COACH_KIND,
SKATE_FILMER_KIND, SKATE_FILMER_KIND,
@ -223,7 +224,7 @@ export function useGrowthStats() {
tradeEvents, tradeEvents,
] = await Promise.all([ ] = await Promise.all([
querySkateContent([{ kinds: [SKATE_SPOT_KIND], '#t': ['skatespot'], limit: 2000 }], { signal }).catch(() => []), querySkateContent([{ kinds: [SKATE_SPOT_KIND], '#t': ['skatespot'], limit: 2000 }], { signal }).catch(() => []),
querySkateContent([{ kinds: [SKATE_SHOP_KIND], limit: 2000 }], { signal }).catch(() => []), querySkateContent([{ kinds: [SKATE_SHOP_KIND], '#t': ['skateshop'], limit: 2000 }], { signal }).catch(() => []),
querySkateContent([{ kinds: [CALENDAR_EVENT_KIND], '#t': ['skateboarding'], limit: 2000 }], { signal }).catch(() => []), querySkateContent([{ kinds: [CALENDAR_EVENT_KIND], '#t': ['skateboarding'], limit: 2000 }], { signal }).catch(() => []),
querySkateContent([{ kinds: [SKATE_COACH_KIND], limit: 500 }], { signal }).catch(() => []), querySkateContent([{ kinds: [SKATE_COACH_KIND], limit: 500 }], { signal }).catch(() => []),
querySkateContent([{ kinds: [SKATE_FILMER_KIND], limit: 500 }], { signal }).catch(() => []), querySkateContent([{ kinds: [SKATE_FILMER_KIND], limit: 500 }], { signal }).catch(() => []),
@ -263,7 +264,11 @@ export function useGrowthStats() {
} }
const spots = dedup(spotEvents); const spots = dedup(spotEvents);
const shops = dedup(shopEvents); // Shops: run the SAME validator the directory uses — kind 30017 is not a
// reserved kind, so other apps (zap.cooking, agent stalls, …) publish
// unrelated events under it on shared relays. Counting raw events put
// those on the "Top Shops" board, labelled with the author's profile name.
const shops = dedup(shopEvents.filter((e) => parseSkateShop(e) !== null));
const events = dedup(calendarEvents); const events = dedup(calendarEvents);
const coaches = dedup(coachEvents); const coaches = dedup(coachEvents);
const filmers = dedup(filmerEvents); const filmers = dedup(filmerEvents);