Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix joining playlists room sometimes not selecting the first item #30812

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion osu.Game/Online/Rooms/JoinRoomRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace osu.Game.Online.Rooms
{
public class JoinRoomRequest : APIRequest
public class JoinRoomRequest : APIRequest<Room>
{
public readonly Room Room;
public readonly string? Password;
Expand Down
6 changes: 5 additions & 1 deletion osu.Game/Screens/OnlinePlay/Components/RoomManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ public virtual void JoinRoom(Room room, string? password = null, Action<Room>? o
currentJoinRoomRequest?.Cancel();
currentJoinRoomRequest = new JoinRoomRequest(room, password);

currentJoinRoomRequest.Success += () =>
currentJoinRoomRequest.Success += result =>
{
joinedRoom.Value = room;
AddOrUpdateRoom(result);
room.CopyFrom(result); // Also copy back to the source model, since this is likely to have been stored elsewhere.
Comment on lines +79 to +80
Copy link
Contributor Author

@smoogipoo smoogipoo Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a char-for-char copy of CreateRoom(). I think everything continues to work correctly without the room.CopyFrom() line, as opposed to CreateRoom() which requires it, but I hope to remove both cases of this in the future.

Just keeping it around to keep things uniform. Can remove if desired.

onSuccess?.Invoke(room);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public bool HandleRequest(APIRequest request, APIUser localUser, BeatmapManager
return true;
}

joinRoomRequest.TriggerSuccess();
joinRoomRequest.TriggerSuccess(createResponseRoom(room, true));
return true;
}

Expand Down
Loading