From 1fc9c68d80ad8136981ab9047effa84a2e343937 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 7 Jan 2026 01:29:44 +0800 Subject: [PATCH] :necktie: Update the requests endpoint to show both sent / received friend requests --- DysonNetwork.Pass/Account/RelationshipController.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DysonNetwork.Pass/Account/RelationshipController.cs b/DysonNetwork.Pass/Account/RelationshipController.cs index bcd57830..fa010ddc 100644 --- a/DysonNetwork.Pass/Account/RelationshipController.cs +++ b/DysonNetwork.Pass/Account/RelationshipController.cs @@ -38,14 +38,17 @@ public class RelationshipController(AppDatabase db, RelationshipService rls) : C [HttpGet("requests")] [Authorize] - public async Task>> ListSentRequests() + public async Task>> ListRelationshipRequests() { if (HttpContext.Items["CurrentUser"] is not SnAccount currentUser) return Unauthorized(); var relationships = await db.AccountRelationships - .Where(r => r.AccountId == currentUser.Id && r.Status == RelationshipStatus.Pending) + .Where(r => r.Status == RelationshipStatus.Pending) + .Where(r => r.AccountId == currentUser.Id || r.RelatedId == currentUser.Id) .Include(r => r.Related) .ThenInclude(a => a.Profile) + .Include(r => r.Account) + .ThenInclude(a => a.Profile) .ToListAsync(); return relationships;