Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
C# annotationscbzcomicinfocomicscomics-readercross-platformcsharpepubepub-readerfreelinuxmangamedia-servermetadataopdsopds-feedpdfself-hostedubooquitywindows
Scan library after we edit library folders, only if folders have differences.
Joseph Milazzo0b486cdc08dd
diff --git a/API/Controllers/LibraryController.cs b/API/Controllers/LibraryController.csindex aba75d760..3b0481866 100644--- a/API/Controllers/LibraryController.cs+++ b/API/Controllers/LibraryController.cs@@ -159,14 +159,24 @@ namespace API.Controllerspublic async Task<ActionResult> UpdateLibrary(UpdateLibraryDto libraryForUserDto){var library = await _libraryRepository.GetLibraryForIdAsync(libraryForUserDto.Id);++ var originalFolders = library.Folders.Select(x => x.Path);+ var differenceBetweenFolders = originalFolders.Except(libraryForUserDto.Folders);+library.Name = libraryForUserDto.Name;library.Folders = libraryForUserDto.Folders.Select(s => new FolderPath() {Path = s}).ToList();++_libraryRepository.Update(library);if (await _libraryRepository.SaveAllAsync()){- // TODO: We should probably call ScanLibrary after this+ if (differenceBetweenFolders.Any())+ {+ BackgroundJob.Enqueue(() => _directoryService.ScanLibrary(library.Id));+ }+return Ok();}