Activities: Category badge shows non-category hashtags (e.g. "OrangePillApp") #21

Open
opened 2026-04-20 05:48:52 +00:00 by padreug · 0 comments
Owner

Problem

ActivityCard shows the first hashtag (t tag) as a category badge, but many NIP-52 events use hashtags that aren't one of our 25 defined categories (e.g. "OrangePillApp", "bitcoin", brand names).

Expected behavior

Only show the category badge if the hashtag matches a known ActivityCategory from src/modules/activities/types/category.ts.

Fix

In src/modules/activities/types/activity.ts, the calendarTimeEventToActivity and calendarDateEventToActivity functions blindly assign event.hashtags[0] as the category:

const category = event.hashtags[0] as ActivityCategory | undefined

Should instead check against ALL_CATEGORIES:

import { ALL_CATEGORIES } from './category'
const category = ALL_CATEGORIES.includes(event.hashtags[0]) ? event.hashtags[0] : undefined

Files

  • src/modules/activities/types/activity.tscalendarTimeEventToActivity(), calendarDateEventToActivity()
  • src/modules/activities/types/category.tsALL_CATEGORIES
## Problem ActivityCard shows the first hashtag (`t` tag) as a category badge, but many NIP-52 events use hashtags that aren't one of our 25 defined categories (e.g. "OrangePillApp", "bitcoin", brand names). ## Expected behavior Only show the category badge if the hashtag matches a known `ActivityCategory` from `src/modules/activities/types/category.ts`. ## Fix In `src/modules/activities/types/activity.ts`, the `calendarTimeEventToActivity` and `calendarDateEventToActivity` functions blindly assign `event.hashtags[0]` as the category: ```typescript const category = event.hashtags[0] as ActivityCategory | undefined ``` Should instead check against `ALL_CATEGORIES`: ```typescript import { ALL_CATEGORIES } from './category' const category = ALL_CATEGORIES.includes(event.hashtags[0]) ? event.hashtags[0] : undefined ``` ## Files - `src/modules/activities/types/activity.ts` — `calendarTimeEventToActivity()`, `calendarDateEventToActivity()` - `src/modules/activities/types/category.ts` — `ALL_CATEGORIES`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aiolabs/webapp#21
No description provided.