mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 19:55:45 +08:00
Move logging and early return into UndeleteForReuse
method itself
This commit is contained in:
parent
6dbfc26158
commit
56427becbb
@ -351,8 +351,7 @@ namespace osu.Game.Stores
|
|||||||
|
|
||||||
using (var transaction = realm.BeginWrite())
|
using (var transaction = realm.BeginWrite())
|
||||||
{
|
{
|
||||||
if (existing.DeletePending)
|
UndeleteForReuse(existing);
|
||||||
UndeleteForReuse(existing);
|
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,12 +387,7 @@ namespace osu.Game.Stores
|
|||||||
{
|
{
|
||||||
LogForModel(item, @$"Found existing {HumanisedModelName} for {item} (ID {existing.ID}) – skipping import.");
|
LogForModel(item, @$"Found existing {HumanisedModelName} for {item} (ID {existing.ID}) – skipping import.");
|
||||||
|
|
||||||
if (existing.DeletePending)
|
UndeleteForReuse(existing);
|
||||||
{
|
|
||||||
LogForModel(item, $@"Existing {HumanisedModelName}'s deletion flag has been removed");
|
|
||||||
UndeleteForReuse(existing);
|
|
||||||
}
|
|
||||||
|
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
|
|
||||||
return existing.ToLive(Realm);
|
return existing.ToLive(Realm);
|
||||||
@ -539,6 +533,10 @@ namespace osu.Game.Stores
|
|||||||
/// <param name="existing">The existing model.</param>
|
/// <param name="existing">The existing model.</param>
|
||||||
protected virtual void UndeleteForReuse(TModel existing)
|
protected virtual void UndeleteForReuse(TModel existing)
|
||||||
{
|
{
|
||||||
|
if (!existing.DeletePending)
|
||||||
|
return;
|
||||||
|
|
||||||
|
LogForModel(existing, $@"Existing {HumanisedModelName}'s deletion flag has been removed to allow for reuse.");
|
||||||
existing.DeletePending = false;
|
existing.DeletePending = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user