소스 검색

Allow removal of all people from an item

Shadowghost 1 년 전
부모
커밋
8a5a93ee80
2개의 변경된 파일9개의 추가작업 그리고 6개의 파일을 삭제
  1. 5 4
      Emby.Server.Implementations/Data/SqliteItemRepository.cs
  2. 4 2
      Emby.Server.Implementations/Library/LibraryManager.cs

+ 5 - 4
Emby.Server.Implementations/Data/SqliteItemRepository.cs

@@ -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();
         }

+ 4 - 2
Emby.Server.Implementations/Library/LibraryManager.cs

@@ -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)