From fa93ed855d1b5fe3731eb5511ce210ff526158ad Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 19:12:32 +0000 Subject: [PATCH 1/2] Initial plan From 9128daa98e8e9d909af43b32197e604194b432ac Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 19:16:48 +0000 Subject: [PATCH 2/2] fix: display requested friend's name in pending partner requests Co-authored-by: JustinhSE <84724234+JustinhSE@users.noreply.github.com> --- src/components/FriendsList.tsx | 54 ++++++++++++++++------------------ src/utils/auth.tsx | 16 ++++++++-- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/components/FriendsList.tsx b/src/components/FriendsList.tsx index a155cef..d39b0cd 100644 --- a/src/components/FriendsList.tsx +++ b/src/components/FriendsList.tsx @@ -73,7 +73,7 @@ const FriendsList: React.FC = () => { const filteredUsernames = usernamesData.filter((user: any) => { return user.id !== auth.currentUser?.uid && !friends.some(friend => friend.id === user.id) && - !friendRequests.outgoing.includes(user.id); + !friendRequests.outgoing.some((u: any) => u.id === user.id); }); setAllUsernames(filteredUsernames); } catch (error) { @@ -541,37 +541,33 @@ const FriendsList: React.FC = () => {

Pending Requests

- {friendRequests.outgoing.map((userId) => { - // Find the user details from allUsernames array - const user = allUsernames.find(u => u.id === userId); - return ( -
-
- - {user ? getInitials(user) : 'U'} - -
-
-

{user ? `${user.firstName} ${user.lastName}` : 'User'}

- - Pending - -
-

{user ? `@${user.username}` : ''}

+ {friendRequests.outgoing.map((outgoingUser) => ( +
+
+ + {getInitials(outgoingUser)} + +
+
+

{outgoingUser.firstName} {outgoingUser.lastName}

+ + Pending +
+

@{outgoingUser.username}

-
- ); - })} + +
+ ))}
)} diff --git a/src/utils/auth.tsx b/src/utils/auth.tsx index f5400bd..5fd471b 100644 --- a/src/utils/auth.tsx +++ b/src/utils/auth.tsx @@ -11,7 +11,7 @@ interface AuthContextType { firebaseInitialized: boolean; friendRequests: { incoming: UserProfile[]; - outgoing: string[]; + outgoing: UserProfile[]; }; friends: UserProfile[]; accountabilityPartners: UserProfile[]; @@ -47,7 +47,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children const [isLoading, setIsLoading] = useState(true); const [firebaseInitialized, setFirebaseInitialized] = useState(!!auth); const [isAdmin, setIsAdmin] = useState(false); - const [friendRequests, setFriendRequests] = useState<{ incoming: UserProfile[], outgoing: string[] }>({ + const [friendRequests, setFriendRequests] = useState<{ incoming: UserProfile[], outgoing: UserProfile[] }>({ incoming: [], outgoing: [] }); @@ -80,10 +80,20 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children } } } + + const outgoingRequests: UserProfile[] = []; + if (profile.friendRequests?.outgoing?.length) { + for (const recipientId of profile.friendRequests.outgoing) { + const recipientProfile = await getUserProfile(recipientId); + if (recipientProfile) { + outgoingRequests.push(recipientProfile); + } + } + } setFriendRequests({ incoming: incomingRequests, - outgoing: profile.friendRequests?.outgoing || [] + outgoing: outgoingRequests }); const friendsList: UserProfile[] = [];