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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user