allows public acces to public profiles
This commit is contained in:
@@ -26,7 +26,7 @@ export async function GET(event: RequestEvent) {
|
||||
let followers: APOrderedCollectionPage;
|
||||
|
||||
// fetch followers locally to not run into auth issues with private profiles
|
||||
if (actor.id === event.locals.user.actor) {
|
||||
if (actor.id === event.locals.user?.actor) {
|
||||
const r = await event.fetch(actor[type as "followers" | "following"]! + '?' + new URLSearchParams({ page }))
|
||||
|
||||
if (!r.ok) {
|
||||
|
||||
@@ -12,9 +12,9 @@ export const load: ServerLoad = async ({ params, locals, fetch }) => {
|
||||
try {
|
||||
const { actor, profile } = await profile_show(params.handle, fetch);
|
||||
|
||||
const isOwnProfile = profile.id === locals.user.actor;
|
||||
const isOwnProfile = profile.id === locals.user?.actor;
|
||||
|
||||
const follow = await follows_a_b(locals.user.actor!, profile.id, fetch) ?? null
|
||||
const follow = locals.user?.actor ? await follows_a_b(locals.user.actor!, profile.id, fetch) : null
|
||||
return { profile, isOwnProfile, follow: follow, actor }
|
||||
|
||||
} catch (e) {
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
<p class="font-semibold">{data.profile.following}</p>
|
||||
<p>{$_("following")}</p>
|
||||
</a>
|
||||
{#if !data.isOwnProfile}
|
||||
{#if !data.isOwnProfile && data.user}
|
||||
<div class="px-6 mt-2">
|
||||
<Button
|
||||
loading={followLoading}
|
||||
|
||||
Reference in New Issue
Block a user