feat(life): add Life Post reaction users modal and API

Add GET /api/life-posts/:id/reactions endpoint with pagination
Add LifeReactionUsersModal to view and filter reaction users
Make reaction summaries clickable in feeds, details, and profiles
This commit is contained in:
2026-05-04 10:10:38 +08:00
parent 7ff7e18b94
commit 579d092020
10 changed files with 583 additions and 11 deletions

View File

@@ -84,6 +84,7 @@ import {
listLifeComments,
listLanguages,
listLifePosts,
listLifePostReactionUsers,
listPokemon,
listPokemonFetchOptions,
listRecipes,
@@ -1209,6 +1210,21 @@ app.get('/api/life-posts/:id', async (request, reply) => {
return post ? post : notFound(reply, request);
});
app.get('/api/life-posts/:id/reactions', async (request, reply) => {
const { id } = request.params as { id: string };
const user = await optionalUser(request);
const canViewAll = user
? userHasPermission(user, 'life.posts.update-any') || userHasPermission(user, 'life.posts.delete-any')
: false;
const reactions = await listLifePostReactionUsers(
Number(id),
request.query as Record<string, string | string[] | undefined>,
user?.id ?? null,
canViewAll
);
return reactions ? reactions : notFound(reply, request);
});
app.get('/api/life-posts/:postId/comments', async (request, reply) => {
const { postId } = request.params as { postId: string };
const user = await optionalUser(request);