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

Merge pull request #19246 from frenzibyte/fix-wiki-navigation

Fix wiki overlay not handling path redirection properly
This commit is contained in:
Dean Herbert 2022-07-20 20:08:11 +09:00 committed by GitHub
commit 62133fa069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@ -11,15 +11,16 @@ namespace osu.Game.Online.API.Requests
{ {
public class GetWikiRequest : APIRequest<APIWikiPage> public class GetWikiRequest : APIRequest<APIWikiPage>
{ {
private readonly string path; public readonly string Path;
private readonly Language language; private readonly Language language;
public GetWikiRequest(string path, Language language = Language.en) public GetWikiRequest(string path, Language language = Language.en)
{ {
this.path = path; Path = path;
this.language = language; this.language = language;
} }
protected override string Target => $"wiki/{language.ToCultureCode()}/{path}"; protected override string Target => $"wiki/{language.ToCultureCode()}/{Path}";
} }
} }

View File

@ -100,6 +100,11 @@ namespace osu.Game.Overlays
private void onPathChanged(ValueChangedEvent<string> e) private void onPathChanged(ValueChangedEvent<string> e)
{ {
// the path could change as a result of redirecting to a newer location of the same page.
// we already have the correct wiki data, so we can safely return here.
if (e.NewValue == wikiData.Value?.Path)
return;
cancellationToken?.Cancel(); cancellationToken?.Cancel();
request?.Cancel(); request?.Cancel();
@ -121,6 +126,7 @@ namespace osu.Game.Overlays
private void onSuccess(APIWikiPage response) private void onSuccess(APIWikiPage response)
{ {
wikiData.Value = response; wikiData.Value = response;
path.Value = response.Path;
if (response.Layout == index_path) if (response.Layout == index_path)
{ {