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:
parent
ef662d3235
commit
26d32cbf28
9 changed files with 252 additions and 100 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue