Misc Bugfixes (#1123)

* Fixed a bug where ComicInfo Count can be a float and we threw a parse error.

* Fixed a bug in download bookmarks which didn't properly create the filepaths for copying. Refactored into a service with a unit test.

In Scanner, repull genres, people and tags between chunk saves to ensure no unique constraint issues.

* Fixed a bug where card detail layout wouldn't refresh the library name on the card between pages

* Fixed an issue where a check to scrolling page back to top was missing in manga reader

* Fixed a bug where cleaning up collection tags without Series was missing after editing a Series.

* Cleaned up the styles for cover chooser

* Added Regex support for "Series 001 (Digital) (somethingwith1234)" and removed support for "A Compendium of Ghosts - 031 - The Third Story_ Part 12" due to complexity in parsing.

* Fixed a miscommunication on how Tachiyomi needs the API MarkChaptersUntilAsRead implemented. Now 0 chapter volumes will be marked.

* Removed unneeded DI
This commit is contained in:
Joseph Milazzo 2022-02-25 19:56:39 -06:00 committed by GitHub
parent f74f356da2
commit 609fe82d6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 140 additions and 42 deletions

View file

@ -11,6 +11,7 @@ using API.DTOs.Reader;
using API.Entities;
using API.Entities.Enums;
using API.Services;
using API.SignalR;
using AutoMapper;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
@ -334,4 +335,65 @@ public class BookmarkServiceTests
Assert.False(ds.FileSystem.FileInfo.FromFileName(Path.Join(BookmarkDirectory, "1/1/1/0001.jpg")).Exists);
}
#endregion
#region GetBookmarkFilesById
[Fact]
public async Task GetBookmarkFilesById_ShouldMatchActualFiles()
{
var filesystem = CreateFileSystem();
filesystem.AddFile($"{CacheDirectory}1/0001.jpg", new MockFileData("123"));
// Delete all Series to reset state
await ResetDB();
_context.Series.Add(new Series()
{
Name = "Test",
Library = new Library() {
Name = "Test LIb",
Type = LibraryType.Manga,
},
Volumes = new List<Volume>()
{
new Volume()
{
Chapters = new List<Chapter>()
{
new Chapter()
{
}
}
}
}
});
_context.AppUser.Add(new AppUser()
{
UserName = "Joe"
});
await _context.SaveChangesAsync();
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);
var bookmarkService = new BookmarkService(Substitute.For<ILogger<BookmarkService>>(), _unitOfWork, ds);
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Bookmarks);
await bookmarkService.BookmarkPage(user, new BookmarkDto()
{
ChapterId = 1,
Page = 1,
SeriesId = 1,
VolumeId = 1
}, $"{CacheDirectory}1/0001.jpg");
var files = await bookmarkService.GetBookmarkFilesById(1, new[] {1});
var actualFiles = ds.GetFiles(BookmarkDirectory, searchOption: SearchOption.AllDirectories);
Assert.Equal(files.Select(API.Parser.Parser.NormalizePath).ToList(), actualFiles.Select(API.Parser.Parser.NormalizePath).ToList());
}
#endregion
}

View file

@ -1568,7 +1568,7 @@ public class ReaderServiceTests
}
[Fact]
public async Task MarkChaptersUntilAsRead_ShouldNotReadOnlyVolumesWithChapter0()
public async Task MarkChaptersUntilAsRead_ShouldMarkAsRead_OnlyVolumesWithChapter0()
{
_context.Series.Add(new Series()
{
@ -1604,7 +1604,7 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
// Validate correct chapters have read status
Assert.False(await _unitOfWork.AppUserProgressRepository.UserHasProgress(LibraryType.Manga, 1));
Assert.True(await _unitOfWork.AppUserProgressRepository.UserHasProgress(LibraryType.Manga, 1));
}
#endregion