From 1fcdf6780607fd3fce3478d891dea0ebb51707b5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Nov 2024 16:20:55 +0900 Subject: [PATCH] Handle response to get accurate mutual state immediately --- .../Profile/Header/Components/FollowersButton.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs b/osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs index 69cb5684fa..c717a627ba 100644 --- a/osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs @@ -95,10 +95,16 @@ private void load(IAPIProvider api, INotificationOverlay? notifications) req.Success += () => { - bool becameFriend = status.Value == FriendStatus.None; - - SetValue(followerCount += becameFriend ? 1 : -1); - status.Value = becameFriend ? FriendStatus.NotMutual : FriendStatus.None; + if (req is AddFriendRequest addedRequest) + { + SetValue(++followerCount); + status.Value = addedRequest.Response?.Mutual == true ? FriendStatus.Mutual : FriendStatus.NotMutual; + } + else + { + SetValue(--followerCount); + status.Value = FriendStatus.None; + } api.UpdateLocalFriends(); HideLoadingLayer();