Allow removal of all people from an item

This commit is contained in:
Shadowghost 2024-05-21 21:14:30 +02:00
parent e67eb48540
commit 8a5a93ee80
2 changed files with 9 additions and 6 deletions

View File

@ -5222,19 +5222,20 @@ AND Type = @InternalPersonType)");
throw new ArgumentNullException(nameof(itemId));
}
ArgumentNullException.ThrowIfNull(people);
CheckDisposed();
using var connection = GetConnection();
using var transaction = connection.BeginTransaction();
// First delete chapters
// Delete all existing people first
using var command = connection.CreateCommand();
command.CommandText = "delete from People where ItemId=@ItemId";
command.TryBind("@ItemId", itemId);
command.ExecuteNonQuery();
InsertPeople(itemId, people, connection);
if (people is not null)
{
InsertPeople(itemId, people, connection);
}
transaction.Commit();
}

View File

@ -2812,8 +2812,10 @@ namespace Emby.Server.Implementations.Library
}
_itemRepository.UpdatePeople(item.Id, people);
await SavePeopleMetadataAsync(people, cancellationToken).ConfigureAwait(false);
if (people is not null)
{
await SavePeopleMetadataAsync(people, cancellationToken).ConfigureAwait(false);
}
}
public async Task<ItemImageInfo> ConvertImageToLocal(BaseItem item, ItemImageInfo image, int imageIndex, bool removeOnFailure)