Release Shakeout Day 2 (#1594)

* Fixed a bad color on the PWA titlebar

* Added more unit tests, cleaned up some dead code, and made it so when age restriction is Not Applicable, the Unknowns field disables

* Don't show an empty menu when user has no permissions

* Fixed deleting a library with relation causing library deleting to fail

* Consolidated some includes code into one method for Series Repo

* Small fixes
This commit is contained in:
Joe Milazzo 2022-10-19 17:48:52 -07:00 committed by GitHub
parent ef662d3235
commit 26d32cbf28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 252 additions and 100 deletions

View file

@ -248,19 +248,24 @@ public class LibraryController : BaseApiController
if (TaskScheduler.HasScanTaskRunningForLibrary(libraryId))
{
// TODO: Figure out how to cancel a job
_logger.LogInformation("User is attempting to delete a library while a scan is in progress");
return BadRequest(
"You cannot delete a library while a scan is in progress. Please wait for scan to continue then try to delete");
}
// Due to a bad schema that I can't figure out how to fix, we need to erase all RelatedSeries before we delete the library
foreach (var s in await _unitOfWork.SeriesRepository.GetSeriesForLibraryIdAsync(library.Id))
// Aka SeriesRelation has an invalid foreign key
foreach (var s in await _unitOfWork.SeriesRepository.GetSeriesForLibraryIdAsync(library.Id,
SeriesIncludes.Related))
{
s.Relations = new List<SeriesRelation>();
_unitOfWork.SeriesRepository.Update(s);
}
await _unitOfWork.CommitAsync();
_unitOfWork.LibraryRepository.Delete(library);
await _unitOfWork.CommitAsync();
if (chapterIds.Any())