Skip to content

Commit

Permalink
Merge pull request ppy#30830 from smoogipoo/multiplayer-remove-expire…
Browse files Browse the repository at this point in the history
…d-item-removal

No longer remove expired playlist items from `Room` model
  • Loading branch information
frenzibyte authored Nov 24, 2024
2 parents 7a973b0 956da03 commit 354bc42
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
18 changes: 1 addition & 17 deletions osu.Game/Online/Rooms/Room.cs
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 366,8 @@ public void CopyFrom(Room other)
{
RoomID = other.RoomID;
Name = other.Name;

Category = other.Category;

if (other.Host != null && Host?.Id != other.Host.Id)
Host = other.Host;

Host = other.Host;
ChannelId = other.ChannelId;
Status = other.Status;
Availability = other.Availability;
Expand All @@ -387,22 383,10 @@ public void CopyFrom(Room other)
PlaylistItemStats = other.PlaylistItemStats;
CurrentPlaylistItem = other.CurrentPlaylistItem;
AutoSkip = other.AutoSkip;

other.RemoveExpiredPlaylistItems();

Playlist = other.Playlist;
RecentParticipants = other.RecentParticipants;
}

public void RemoveExpiredPlaylistItems()
{
// Todo: This is not the best way/place to do this, but the intention is to display all playlist items when the room has ended,
// and display only the non-expired playlist items while the room is still active. In order to achieve this, all expired items are removed from the source Room.
// More refactoring is required before this can be done locally instead - DrawableRoomPlaylist is currently directly bound to the playlist to display items in the room.
if (Status is not RoomStatusEnded)
Playlist = Playlist.Where(i => !i.Expired).ToArray();
}

[JsonObject(MemberSerialization.OptIn)]
public class RoomPlaylistItemStats
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 60,7 @@ protected override Task Poll()
}
foreach (var incoming in result)
{
incoming.RemoveExpiredPlaylistItems();
RoomManager.AddOrUpdateRoom(incoming);
}
initialRoomsReceived.Value = true;
tcs.SetResult(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 36,6 @@ protected override Task Poll()

req.Success = result =>
{
result.RemoveExpiredPlaylistItems();
RoomManager.AddOrUpdateRoom(result);
tcs.SetResult(true);
};
Expand Down

0 comments on commit 354bc42

Please sign in to comment.