adds profile link for comments

This commit is contained in:
Christian Beutel
2024-12-20 17:23:46 +01:00
parent 92f0b033fa
commit 034f6873c1
2 changed files with 36 additions and 5 deletions

View File

@@ -39,13 +39,38 @@
in:fade={{ duration: 150 }}
out:fade={{ duration: 150 }}
>
<img class="rounded-full w-10 aspect-square" src={avatarSrc} alt="avatar" />
{#if comment.expand?.author.private}
<img
class="rounded-full w-10 aspect-square"
src={avatarSrc}
alt="avatar"
/>
{:else}
<a
href="/profile/{comment.expand?.author.id}"
class="text-sm font-semibold"
>
<img
class="rounded-full w-10 aspect-square"
src={avatarSrc}
alt="avatar"
/>
</a>
{/if}
<div>
<div class="flex items-center">
<p class="">
<span class="text-sm font-semibold"
>{comment.expand?.author.username}</span
>
{#if comment.expand?.author.private}
<span class="text-sm font-semibold"
>{comment.expand?.author.username}</span
>
{:else}
<a
href="/profile/{comment.expand?.author.id}"
class="text-sm font-semibold"
>{comment.expand?.author.username}</a
>
{/if}
<span class="text-xs text-gray-500 ml-2"
>{$_(`n-${timeSince.unit}-ago`, {
values: { n: timeSince.value },

View File

@@ -6,7 +6,13 @@ export async function GET(event: RequestEvent) {
const page = event.url.searchParams.get("page") ?? "0";
const perPage = event.url.searchParams.get("per-page") ?? "10";
const sort = event.url.searchParams.get("sort") ?? ""
const filter = event.url.searchParams.get("filter") ?? "";
let filter = event.url.searchParams.get("filter") ?? "";
if (!filter.length) {
filter = "private=false"
} else {
filter += "&&private=false"
}
try {
const r = await pb.collection('users_anonymous')