1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 09:47:24 +08:00

remove CreateAPIRelationFromAPIUser

This commit is contained in:
cdwcgt 2024-11-01 19:24:58 +08:00
parent fbe6077ec2
commit 1a92e5ad19
No known key found for this signature in database
GPG Key ID: 144396D01095C3A2
4 changed files with 35 additions and 21 deletions

View File

@ -155,7 +155,13 @@ namespace osu.Game.Tests.Visual.Gameplay
var api = (DummyAPIAccess)API;
api.Friends.Clear();
api.Friends.Add(CreateAPIRelationFromAPIUser(friend));
api.Friends.Add(new APIRelation
{
Mutual = true,
RelationType = RelationType.Friend,
TargetID = friend.OnlineID,
TargetUser = friend
});
});
int playerNumber = 1;

View File

@ -30,15 +30,21 @@ namespace osu.Game.Tests.Visual.Online
if (supportLevel > 3)
supportLevel = 0;
((DummyAPIAccess)API).Friends.Add(CreateAPIRelationFromAPIUser(new APIUser
((DummyAPIAccess)API).Friends.Add(new APIRelation
{
Username = @"peppy",
Id = 2,
Colour = "99EB47",
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
IsSupporter = supportLevel > 0,
SupportLevel = supportLevel
}));
TargetID = 2,
RelationType = RelationType.Friend,
Mutual = true,
TargetUser = new APIUser
{
Username = @"peppy",
Id = 2,
Colour = "99EB47",
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
IsSupporter = supportLevel > 0,
SupportLevel = supportLevel
}
});
}
}

View File

@ -431,7 +431,13 @@ namespace osu.Game.Tests.Visual.Online
if (req.TargetId != nonFriend.OnlineID)
return false;
var apiRelation = CreateAPIRelationFromAPIUser(nonFriend);
var apiRelation = new APIRelation
{
TargetID = nonFriend.OnlineID,
Mutual = true,
RelationType = RelationType.Friend,
TargetUser = nonFriend
};
Task.Run(() =>
{
@ -465,8 +471,13 @@ namespace osu.Game.Tests.Visual.Online
if (req.TargetId != nonFriend.OnlineID)
return false;
var apiRelation = CreateAPIRelationFromAPIUser(nonFriend);
apiRelation.Mutual = false;
var apiRelation = new APIRelation
{
TargetID = nonFriend.OnlineID,
Mutual = false,
RelationType = RelationType.Friend,
TargetUser = nonFriend
};
Task.Run(() =>
{

View File

@ -317,15 +317,6 @@ namespace osu.Game.Tests.Visual
return result;
}
public static APIRelation CreateAPIRelationFromAPIUser(APIUser user) =>
new APIRelation
{
Mutual = true,
RelationType = RelationType.Friend,
TargetID = user.OnlineID,
TargetUser = user
};
protected WorkingBeatmap CreateWorkingBeatmap(RulesetInfo ruleset) =>
CreateWorkingBeatmap(CreateBeatmap(ruleset));