mirror of
https://github.com/ppy/osu
synced 2025-04-10 11:11:48 +00:00
Merge pull request #19246 from frenzibyte/fix-wiki-navigation
Fix wiki overlay not handling path redirection properly
This commit is contained in:
commit
62133fa069
File diff suppressed because one or more lines are too long
@ -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}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user