mirror of
https://github.com/ppy/osu.git
synced 2026-06-01 01:10:22 +08:00
Pick better initial beatmap status when submitting
Addresses https://github.com/ppy/osu/discussions/33291 This is a half-baked RFC because things are awkward. For this to work correctly the submission flow has to do an API request, because one, the local beatmap status has been overwritten with "locally modified", and secondly, even if it *was* there, there's no guarantee that it was actually *up to date*. And if we have to do an API request then there are two choices: - Hard block on the API request and don't show anything until it completes which possibly means waiting at a spinner for several seconds if someone's on bad internet. - Don't block on the API request --- but then there's no guarantee what timing the API request completes at, which means that possibly the user could change the dropdown before the API request completes, and the API request will overwrite their choice, so to prevent that block the dropdown until the request completes. This is what this commit does.
This commit is contained in:
@@ -191,6 +191,13 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
});
|
||||
|
||||
completedSample = audio.Samples.Get(@"UI/bss-complete");
|
||||
|
||||
if (Beatmap.Value.BeatmapSetInfo.OnlineID > 0)
|
||||
{
|
||||
var req = new GetBeatmapSetRequest(Beatmap.Value.BeatmapSetInfo.OnlineID);
|
||||
api.Queue(req);
|
||||
settings.LatestOnlineStateRequest = req;
|
||||
}
|
||||
}
|
||||
|
||||
private void createBeatmapSet()
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
{
|
||||
public class BeatmapSubmissionSettings
|
||||
{
|
||||
public GetBeatmapSetRequest? LatestOnlineStateRequest { get; set; }
|
||||
|
||||
public Bindable<BeatmapSubmissionTarget> Target { get; } = new Bindable<BeatmapSubmissionTarget>();
|
||||
|
||||
public Bindable<bool> NotifyOnDiscussionReplies { get; } = new Bindable<bool>();
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays;
|
||||
using osuTK;
|
||||
@@ -25,8 +28,11 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
|
||||
public override LocalisableString? NextStepText => BeatmapSubmissionStrings.ConfirmSubmission;
|
||||
|
||||
[Resolved]
|
||||
private BeatmapSubmissionSettings settings { get; set; } = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager configManager, OsuColour colours, BeatmapSubmissionSettings settings)
|
||||
private void load(OsuConfigManager configManager, OsuColour colours)
|
||||
{
|
||||
configManager.BindWith(OsuSetting.EditorSubmissionNotifyOnDiscussionReplies, settings.NotifyOnDiscussionReplies);
|
||||
configManager.BindWith(OsuSetting.EditorSubmissionLoadInBrowserAfterSubmission, loadInBrowserAfterSubmission);
|
||||
@@ -63,6 +69,25 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
switch (settings.LatestOnlineStateRequest?.CompletionState)
|
||||
{
|
||||
case APIRequestCompletionState.Completed:
|
||||
setSubmissionTargetFromLatestOnlineState();
|
||||
break;
|
||||
|
||||
case APIRequestCompletionState.Waiting:
|
||||
settings.Target.Disabled = true;
|
||||
settings.LatestOnlineStateRequest.Success += _ => setSubmissionTargetFromLatestOnlineState();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void setSubmissionTargetFromLatestOnlineState()
|
||||
{
|
||||
Debug.Assert(settings.LatestOnlineStateRequest != null);
|
||||
settings.Target.Disabled = false;
|
||||
settings.Target.Value = settings.LatestOnlineStateRequest.Response?.Status >= BeatmapOnlineStatus.Pending ? BeatmapSubmissionTarget.Pending : BeatmapSubmissionTarget.WIP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user