Sifa professional network API (Fastify, AT Protocol, Jetstream) sifa.id/

feat(activity): include availableCategories in feed response (#136)

Add an availableCategories string array to the activity feed response,
derived from visible active app stats. This lets the frontend hide
category filter tabs when a user has content in only one category.

Closes singi-labs/sifa-web#327

authored by

Guido X Jansen and committed by
GitHub
2e05f774 01f31236

+11 -1
+11 -1
src/routes/activity.ts
··· 333 333 const stats = await getVisibleAppStats(db, did); 334 334 const registry = getAppsRegistry(); 335 335 336 + // Compute available categories from all visible active apps 337 + const availableCategories = [ 338 + ...new Set( 339 + stats 340 + .filter((s) => s.isActive) 341 + .map((s) => registry.find((e) => e.id === s.appId)?.category) 342 + .filter((c): c is string => c !== undefined), 343 + ), 344 + ]; 345 + 336 346 // Filter apps by category if specified 337 347 let targetApps: { stat: (typeof stats)[number]; entry: AppRegistryEntry }[]; 338 348 if (categoryParam === 'all') { ··· 463 473 ? Buffer.from(JSON.stringify({ cursors: newCursors }), 'utf-8').toString('base64url') 464 474 : null; 465 475 466 - return reply.send({ items, cursor: compositeCursor, hasMore }); 476 + return reply.send({ items, cursor: compositeCursor, hasMore, availableCategories }); 467 477 }); 468 478 469 479 // POST /api/privacy/suppress -- GDPR erasure endpoint (no auth required)