fix: full fediverse handle display + follower count includes remote
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Has been cancelled
test / unit (pull_request) Has been cancelled
test / integration (pull_request) Has been cancelled
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Has been cancelled
test / unit (pull_request) Has been cancelled
test / integration (pull_request) Has been cancelled
This commit is contained in:
@@ -3,6 +3,8 @@ import {
|
||||
getFollowersList,
|
||||
getFollowingList,
|
||||
getMe,
|
||||
getRemoteFollowers,
|
||||
getRemoteFollowing,
|
||||
getTopFriends,
|
||||
getUserProfile,
|
||||
getUserThoughts,
|
||||
@@ -95,16 +97,27 @@ export default async function ProfilePage({ params }: ProfilePageProps) {
|
||||
thoughtsResult.status === "fulfilled" ? thoughtsResult.value.items : [];
|
||||
const thoughtThreads = buildThoughtThreads(thoughts);
|
||||
|
||||
const followersCount =
|
||||
const localFollowersCount =
|
||||
followersResult.status === "fulfilled"
|
||||
? followersResult.value.total
|
||||
: 0;
|
||||
const followingCount =
|
||||
const localFollowingCount =
|
||||
followingResult.status === "fulfilled"
|
||||
? followingResult.value.total
|
||||
: 0;
|
||||
|
||||
const isOwnProfile = me?.username === user.username;
|
||||
|
||||
const [remoteFollowersCount, remoteFollowingCount] =
|
||||
isOwnProfile && token
|
||||
? await Promise.all([
|
||||
getRemoteFollowers(token).then((r) => r.length).catch(() => 0),
|
||||
getRemoteFollowing(token).then((r) => r.length).catch(() => 0),
|
||||
])
|
||||
: [0, 0];
|
||||
|
||||
const followersCount = localFollowersCount + remoteFollowersCount;
|
||||
const followingCount = localFollowingCount + remoteFollowingCount;
|
||||
const isFollowing = user.isFollowedByViewer;
|
||||
|
||||
const apiDomain = process.env.NEXT_PUBLIC_API_URL
|
||||
|
||||
Reference in New Issue
Block a user