Fix beatmap mass deletion flow

This commit is contained in:
Dean Herbert 2022-01-11 22:57:47 +09:00
parent d5239d550a
commit 46206f70d6
2 changed files with 14 additions and 1 deletions

View File

@ -234,6 +234,19 @@ namespace osu.Game.Beatmaps
beatmapModelManager.Delete(items, silent);
}
public void Delete(Expression<Func<BeatmapSetInfo, bool>>? filter = null, bool silent = false)
{
using (var context = contextFactory.CreateContext())
{
var items = context.All<BeatmapSetInfo>().Where(s => !s.DeletePending);
if (filter != null)
items = items.Where(filter);
beatmapModelManager.Delete(items.ToList(), silent);
}
}
public void Undelete(List<BeatmapSetInfo> items, bool silent = false)
{
beatmapModelManager.Undelete(items, silent);

View File

@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
dialogOverlay?.Push(new MassDeleteConfirmationDialog(() =>
{
deleteBeatmapsButton.Enabled.Value = false;
Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
Task.Run(() => beatmaps.Delete()).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
}));
}
});