fix: profile friends section shows profile owner's following list, not viewer's
Some checks failed
lint / lint (push) Has been cancelled
test / integration (push) Has been cancelled
test / unit (push) Has been cancelled
lint / lint (pull_request) Failing after 9m46s
test / unit (pull_request) Successful in 16m32s
test / integration (pull_request) Failing after 17m49s

This commit is contained in:
2026-05-14 18:08:50 +02:00
parent 171cfe4373
commit e61e5b4cec

View File

@@ -1,7 +1,6 @@
import {
getFollowersList,
getFollowingList,
getFriends,
getMe,
getTopFriends,
getUserProfile,
@@ -74,9 +73,10 @@ export default async function ProfilePage({ params }: ProfilePageProps) {
const authorDetails = new Map<string, { avatarUrl?: string | null }>();
authorDetails.set(user.username, { avatarUrl: user.avatarUrl });
// Show who the profile owner follows (uses the already-fetched followingResult).
const friends =
typeof token === "string"
? (await getFriends(token)).users.map((u) => u.username)
followingResult.status === "fulfilled"
? followingResult.value.items.map((u) => u.username)
: [];
const topFriendsData = await getTopFriends(username, token).catch(() => ({ topFriends: [] }));