From 625b9ead4c1eec712824d59b91bf7cd00479cb3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 Jul 2018 21:00:23 +0900 Subject: [PATCH 1/2] Fix links from profile top scores to beatmaps not working correctly --- osu.Game/Beatmaps/BeatmapMetadata.cs | 1 - osu.Game/Online/API/Requests/Responses/APIScore.cs | 9 ++++++++- .../Profile/Sections/BeatmapMetadataContainer.cs | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapMetadata.cs b/osu.Game/Beatmaps/BeatmapMetadata.cs index 6c1bcd0531..57983ec568 100644 --- a/osu.Game/Beatmaps/BeatmapMetadata.cs +++ b/osu.Game/Beatmaps/BeatmapMetadata.cs @@ -14,7 +14,6 @@ namespace osu.Game.Beatmaps public class BeatmapMetadata : IEquatable { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - [JsonIgnore] public int ID { get; set; } public string Title { get; set; } diff --git a/osu.Game/Online/API/Requests/Responses/APIScore.cs b/osu.Game/Online/API/Requests/Responses/APIScore.cs index a398bf46ee..25eb32a79f 100644 --- a/osu.Game/Online/API/Requests/Responses/APIScore.cs +++ b/osu.Game/Online/API/Requests/Responses/APIScore.cs @@ -63,7 +63,14 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"beatmapset")] private BeatmapMetadata metadata { - set => Beatmap.Metadata = value; + set + { + // extract the set ID to its correct place. + Beatmap.BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = value.ID }; + value.ID = 0; + + Beatmap.Metadata = value; + } } [JsonProperty(@"statistics")] diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index 359bfc7564..eaa0ac4aaa 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -9,6 +9,7 @@ using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; + namespace osu.Game.Overlays.Profile.Sections { /// @@ -32,7 +33,10 @@ namespace osu.Game.Overlays.Profile.Sections { Action = () => { - if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); + if (beatmap.OnlineBeatmapID != null) + beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.OnlineBeatmapID.Value); + else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) + beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); }; Child = new FillFlowContainer From bf1ce8cdd8895f618437ca39857609bc15871f84 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 10 Jul 2018 16:02:13 +0900 Subject: [PATCH 2/2] Fix linking still being broken --- osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index eaa0ac4aaa..1a1f13933d 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Profile.Sections Action = () => { if (beatmap.OnlineBeatmapID != null) - beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.OnlineBeatmapID.Value); + beatmapSetOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value); else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); };