Skip to content

Commit

Permalink
Handle response to get accurate mutual state immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Nov 5, 2024
1 parent 0087270 commit 1fcdf67
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1fcdf67

Please sign in to comment.