makes profiles public
This commit is contained in:
@@ -11,6 +11,16 @@ export async function GET(event: RequestEvent) {
|
||||
sort: "+date",
|
||||
filter: filter
|
||||
})
|
||||
|
||||
for (const t of r) {
|
||||
if (!t.author || !pb.authStore.model) {
|
||||
continue;
|
||||
}
|
||||
if (!t.expand) {
|
||||
t.expand = {} as any
|
||||
}
|
||||
t.expand.author = await pb.collection("users_anonymous").getOne(t.author);
|
||||
}
|
||||
return json(r)
|
||||
} catch (e: any) {
|
||||
throw error(e.status, e);
|
||||
|
||||
@@ -7,6 +7,12 @@ export async function GET(event: RequestEvent) {
|
||||
try {
|
||||
const r = await pb.collection('summit_logs')
|
||||
.getOne<SummitLog>(event.params.id as string)
|
||||
|
||||
if (!r.expand) {
|
||||
r.expand = {} as any
|
||||
}
|
||||
r.expand.author = await pb.collection("users_anonymous").getOne(r.author!);
|
||||
|
||||
return json(r)
|
||||
} catch (e: any) {
|
||||
throw error(e.status, e);
|
||||
|
||||
@@ -21,9 +21,15 @@ export async function GET(event: RequestEvent) {
|
||||
r.date = r.date?.substring(0, 10) ?? ""
|
||||
for (const log of r.expand?.summit_logs ?? []) {
|
||||
log.date = log.date.substring(0, 10)
|
||||
|
||||
if (!log.expand) {
|
||||
log.expand = {} as any
|
||||
}
|
||||
log.expand.author = await pb.collection("users_anonymous").getOne(log.author!);
|
||||
}
|
||||
return json(r)
|
||||
} catch (e: any) {
|
||||
console.error(e)
|
||||
throw error(e.status || 500, e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user