mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 13:22:55 +08:00
Merge remote-tracking branch 'upstream/master' into update-framework
This commit is contained in:
commit
a4bf21268b
@ -282,17 +282,19 @@ namespace osu.Game.Database
|
||||
/// Is a no-op for already deleted items.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to delete.</param>
|
||||
public void Delete(TModel item)
|
||||
/// <returns>false if no operation was performed</returns>
|
||||
public bool Delete(TModel item)
|
||||
{
|
||||
using (ContextFactory.GetForWrite())
|
||||
{
|
||||
// re-fetch the model on the import context.
|
||||
var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).First(s => s.ID == item.ID);
|
||||
var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID);
|
||||
|
||||
if (foundModel.DeletePending) return;
|
||||
if (foundModel == null || foundModel.DeletePending) return false;
|
||||
|
||||
if (ModelStore.Delete(foundModel))
|
||||
Files.Dereference(foundModel.Files.Select(f => f.FileInfo).ToArray());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -536,7 +536,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private void delete(BeatmapSetInfo beatmap)
|
||||
{
|
||||
if (beatmap == null) return;
|
||||
if (beatmap == null || beatmap.ID <= 0) return;
|
||||
dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user