mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 10:17:19 +08:00
Update soft-deletion logic to use model store's consumable items instead
This commit is contained in:
parent
df04dd21de
commit
738c94d193
@ -76,7 +76,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
protected readonly IDatabaseContextFactory ContextFactory;
|
protected readonly IDatabaseContextFactory ContextFactory;
|
||||||
|
|
||||||
protected readonly MutableDatabaseBackedStore<TModel> ModelStore;
|
protected readonly MutableDatabaseBackedStoreWithFileIncludes<TModel, TFileModel> ModelStore;
|
||||||
|
|
||||||
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
|
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
|
||||||
private ArchiveImportIPCChannel ipc;
|
private ArchiveImportIPCChannel ipc;
|
||||||
@ -492,7 +492,7 @@ namespace osu.Game.Database
|
|||||||
using (ContextFactory.GetForWrite())
|
using (ContextFactory.GetForWrite())
|
||||||
{
|
{
|
||||||
// re-fetch the model on the import context.
|
// re-fetch the model on the import context.
|
||||||
var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID);
|
var foundModel = ModelStore.ConsumableItems.SingleOrDefault(i => i.ID == item.ID);
|
||||||
|
|
||||||
if (foundModel == null || foundModel.DeletePending) return false;
|
if (foundModel == null || foundModel.DeletePending) return false;
|
||||||
|
|
||||||
@ -731,8 +731,6 @@ namespace osu.Game.Database
|
|||||||
yield return f.Filename;
|
yield return f.Filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DbSet<TModel> queryModel() => ContextFactory.Get().Set<TModel>();
|
|
||||||
|
|
||||||
protected virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace("Info", "").ToLower()}";
|
protected virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace("Info", "").ToLower()}";
|
||||||
|
|
||||||
#region Event handling / delaying
|
#region Event handling / delaying
|
||||||
|
Loading…
x
Reference in New Issue
Block a user