mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:57:36 +08:00
Remove weird fetchOnline
logic
This commit is contained in:
parent
1f5ca122b0
commit
ba74dd93b2
@ -71,13 +71,13 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
AddStep("Show offline dummy", () => profile.ShowUser(TEST_USER, false));
|
||||
AddStep("Show offline dummy", () => profile.ShowUser(TEST_USER));
|
||||
|
||||
AddStep("Show null dummy", () => profile.ShowUser(new APIUser
|
||||
{
|
||||
Username = @"Null",
|
||||
Id = 1,
|
||||
}, false));
|
||||
}));
|
||||
|
||||
AddStep("Show ppy", () => profile.ShowUser(new APIUser
|
||||
{
|
||||
@ -86,7 +86,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
IsSupporter = true,
|
||||
Country = new Country { FullName = @"Australia", FlagName = @"AU" },
|
||||
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg"
|
||||
}, api.IsLoggedIn));
|
||||
}));
|
||||
|
||||
AddStep("Show flyte", () => profile.ShowUser(new APIUser
|
||||
{
|
||||
@ -94,7 +94,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Id = 3103765,
|
||||
Country = new Country { FullName = @"Japan", FlagName = @"JP" },
|
||||
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
|
||||
}, api.IsLoggedIn));
|
||||
}));
|
||||
|
||||
AddStep("Show bancho", () => profile.ShowUser(new APIUser
|
||||
{
|
||||
@ -103,10 +103,10 @@ namespace osu.Game.Tests.Visual.Online
|
||||
IsBot = true,
|
||||
Country = new Country { FullName = @"Saint Helena", FlagName = @"SH" },
|
||||
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg"
|
||||
}, api.IsLoggedIn));
|
||||
}));
|
||||
|
||||
AddStep("Show ppy from username", () => profile.ShowUser(@"peppy"));
|
||||
AddStep("Show flyte from username", () => profile.ShowUser(@"flyte"));
|
||||
AddStep("Show ppy from username", () => profile.ShowUser(new APIUser { Username = @"peppy" }));
|
||||
AddStep("Show flyte from username", () => profile.ShowUser(new APIUser { Username = @"flyte" }));
|
||||
|
||||
AddStep("Hide", profile.Hide);
|
||||
AddStep("Show without reload", profile.Show);
|
||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
public void ShowUser(string username) => ShowUser(new APIUser { Username = username });
|
||||
|
||||
public void ShowUser(APIUser user, bool fetchOnline = true)
|
||||
public void ShowUser(IUser user)
|
||||
{
|
||||
if (user == APIUser.SYSTEM_USER)
|
||||
return;
|
||||
@ -116,19 +116,20 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
};
|
||||
|
||||
if (fetchOnline)
|
||||
{
|
||||
userReq = user.Id > 1 ? new GetUserRequest(user.Id) : new GetUserRequest(user.Username);
|
||||
userReq.Success += userLoadComplete;
|
||||
API.Queue(userReq);
|
||||
}
|
||||
else
|
||||
sectionsContainer.ScrollToTop();
|
||||
|
||||
// Check arbitrarily whether this user has already been populated.
|
||||
// This is only generally used by tests, but should be quite safe unless we want to force a refresh on loading a previous user in the future.
|
||||
if (user is APIUser apiUser && apiUser.JoinDate != default)
|
||||
{
|
||||
userReq = null;
|
||||
userLoadComplete(user);
|
||||
userLoadComplete(apiUser);
|
||||
return;
|
||||
}
|
||||
|
||||
sectionsContainer.ScrollToTop();
|
||||
userReq = user.OnlineID > 1 ? new GetUserRequest(user.OnlineID) : new GetUserRequest(user.Username);
|
||||
userReq.Success += userLoadComplete;
|
||||
API.Queue(userReq);
|
||||
}
|
||||
|
||||
private void userLoadComplete(APIUser user)
|
||||
|
Loading…
Reference in New Issue
Block a user