From a8f6c8d9115d03e909d39c5564e538733bb1cc5e Mon Sep 17 00:00:00 2001 From: Imtiaz Ahmed Khan Date: Sat, 7 Sep 2024 22:45:41 +0600 Subject: [PATCH] showing name in comments when its set --- .../src/api/trpc/procedures/comments/crud.mts | 6 +++--- .../app/petitions/[id]/_components/comments/Comment.tsx | 8 +++++--- .../src/app/petitions/[id]/_components/comments/Reply.tsx | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/jonogon-core/src/api/trpc/procedures/comments/crud.mts b/apps/jonogon-core/src/api/trpc/procedures/comments/crud.mts index b377c12d..f1bdac3c 100644 --- a/apps/jonogon-core/src/api/trpc/procedures/comments/crud.mts +++ b/apps/jonogon-core/src/api/trpc/procedures/comments/crud.mts @@ -76,7 +76,7 @@ export const listComments = publicProcedure .on('user_vote.user_id', '=', `${ctx.auth?.user_id}`), ) .select(({fn}) => [ - 'users.username as username', + 'users.name as username', 'users.id as user_id', 'users.picture as profile_picture', 'comments.created_by', @@ -158,7 +158,7 @@ export const listReplies = publicProcedure .on('user_vote.user_id', '=', `${ctx.auth?.user_id}`), ) .select(({fn}) => [ - 'users.username as username', + 'users.name as username', 'users.id as user_id', 'users.picture as profile_picture', 'comments.created_by', @@ -263,7 +263,7 @@ export const createComment = protectedProcedure (qb) => qb .selectFrom('users') - .select('users.username') + .select('users.name') .whereRef('users.id', '=', 'comments.created_by') .as('username'), (qb) => diff --git a/apps/jonogon-web-next/src/app/petitions/[id]/_components/comments/Comment.tsx b/apps/jonogon-web-next/src/app/petitions/[id]/_components/comments/Comment.tsx index 12bcebda..c5382f45 100644 --- a/apps/jonogon-web-next/src/app/petitions/[id]/_components/comments/Comment.tsx +++ b/apps/jonogon-web-next/src/app/petitions/[id]/_components/comments/Comment.tsx @@ -101,14 +101,16 @@ export default function Comment({data}: CommentProps) {
{data.username ? ( <> -

@imtiaz

+

{data.username}

- Jonogon-User-1 + Jonogon-User-{data.created_by}

) : ( <> -

Jonogon-User-1

+

+ Jonogon-User-{data.created_by} +

)}
diff --git a/apps/jonogon-web-next/src/app/petitions/[id]/_components/comments/Reply.tsx b/apps/jonogon-web-next/src/app/petitions/[id]/_components/comments/Reply.tsx index 101f28ec..f6e87215 100644 --- a/apps/jonogon-web-next/src/app/petitions/[id]/_components/comments/Reply.tsx +++ b/apps/jonogon-web-next/src/app/petitions/[id]/_components/comments/Reply.tsx @@ -59,7 +59,7 @@ export default function Reply({
{data.username ? ( <> -

@{data.username}

+

{data.username}

Jonogon-User-{data.created_by}