1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 17:32:54 +08:00

Store full model rather than online ID only

This commit is contained in:
Bartłomiej Dach 2021-11-08 13:42:56 +01:00
parent 72489b32f9
commit 74603253d2
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -23,7 +23,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
set => current.Current = value;
}
private readonly int onlineBeatmapID;
private readonly APIBeatmapSet beatmapSet;
private PostBeatmapFavouriteRequest favouriteRequest;
@ -33,7 +33,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
public FavouriteButton(APIBeatmapSet beatmapSet)
{
current = new BindableWithCurrent<BeatmapSetFavouriteState>(new BeatmapSetFavouriteState(beatmapSet.HasFavourited, beatmapSet.FavouriteCount));
onlineBeatmapID = beatmapSet.OnlineID;
this.beatmapSet = beatmapSet;
}
protected override void LoadComplete()
@ -49,7 +49,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
var actionType = current.Value.Favourited ? BeatmapFavouriteAction.UnFavourite : BeatmapFavouriteAction.Favourite;
favouriteRequest?.Cancel();
favouriteRequest = new PostBeatmapFavouriteRequest(onlineBeatmapID, actionType);
favouriteRequest = new PostBeatmapFavouriteRequest(beatmapSet.OnlineID, actionType);
Enabled.Value = false;
favouriteRequest.Success += () =>