diff --git a/API.Tests/Services/BookServiceTests.cs b/API.Tests/Services/BookServiceTests.cs index 07fa2936d..f8b726ac5 100644 --- a/API.Tests/Services/BookServiceTests.cs +++ b/API.Tests/Services/BookServiceTests.cs @@ -22,16 +22,18 @@ namespace API.Tests.Services [InlineData("The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub", 16)] [InlineData("Non-existent file.epub", 0)] [InlineData("Non an ebub.pdf", 0)] + [InlineData("test_ſ.pdf", 1)] // This is dependent on Docnet bug https://github.com/GowenGit/docnet/issues/80 + [InlineData("test.pdf", 1)] public void GetNumberOfPagesTest(string filePath, int expectedPages) { - var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService/EPUB"); + var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService"); Assert.Equal(expectedPages, _bookService.GetNumberOfPages(Path.Join(testDirectory, filePath))); } [Fact] public void ShouldHaveComicInfo() { - var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService/EPUB"); + var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService"); var archive = Path.Join(testDirectory, "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"); const string summaryInfo = "Book Description"; @@ -44,7 +46,7 @@ namespace API.Tests.Services [Fact] public void ShouldHaveComicInfo_WithAuthors() { - var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService/EPUB"); + var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService"); var archive = Path.Join(testDirectory, "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"); var comicInfo = _bookService.GetComicInfo(archive); @@ -52,16 +54,5 @@ namespace API.Tests.Services Assert.Equal("Roger Starbuck,Junya Inoue", comicInfo.Writer); } - - #region BookEscaping - - [Fact] - public void EscapeCSSImportReferencesTest() - { - - } - - #endregion - } } diff --git a/API.Tests/Services/ReaderServiceTests.cs b/API.Tests/Services/ReaderServiceTests.cs index 90bd2d279..f50cdd196 100644 --- a/API.Tests/Services/ReaderServiceTests.cs +++ b/API.Tests/Services/ReaderServiceTests.cs @@ -2014,7 +2014,6 @@ public class ReaderServiceTests #endregion - #region MarkSeriesAsRead [Fact] diff --git a/API.Tests/Services/Test Data/BookService/EPUB/The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub b/API.Tests/Services/Test Data/BookService/The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub similarity index 100% rename from API.Tests/Services/Test Data/BookService/EPUB/The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub rename to API.Tests/Services/Test Data/BookService/The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub diff --git a/API.Tests/Services/Test Data/BookService/EPUB/content.opf b/API.Tests/Services/Test Data/BookService/content.opf similarity index 100% rename from API.Tests/Services/Test Data/BookService/EPUB/content.opf rename to API.Tests/Services/Test Data/BookService/content.opf diff --git a/API.Tests/Services/Test Data/BookService/test.pdf b/API.Tests/Services/Test Data/BookService/test.pdf new file mode 100644 index 000000000..9fe4811a7 Binary files /dev/null and b/API.Tests/Services/Test Data/BookService/test.pdf differ diff --git a/API.Tests/Services/Test Data/BookService/test_ſ.pdf b/API.Tests/Services/Test Data/BookService/test_ſ.pdf new file mode 100644 index 000000000..9fe4811a7 Binary files /dev/null and b/API.Tests/Services/Test Data/BookService/test_ſ.pdf differ diff --git a/API/API.csproj b/API/API.csproj index 4853568e0..0af5832f3 100644 --- a/API/API.csproj +++ b/API/API.csproj @@ -40,7 +40,7 @@ - + diff --git a/API/Controllers/AccountController.cs b/API/Controllers/AccountController.cs index 05867362f..d5336917c 100644 --- a/API/Controllers/AccountController.cs +++ b/API/Controllers/AccountController.cs @@ -727,21 +727,18 @@ namespace API.Controllers private async Task ConfirmEmailToken(string token, AppUser user) { var result = await _userManager.ConfirmEmailAsync(user, token); - if (!result.Succeeded) - { - _logger.LogCritical("Email validation failed"); - if (result.Errors.Any()) - { - foreach (var error in result.Errors) - { - _logger.LogCritical("Email validation error: {Message}", error.Description); - } - } + if (result.Succeeded) return true; - return false; + _logger.LogCritical("[Account] Email validation failed"); + if (!result.Errors.Any()) return false; + + foreach (var error in result.Errors) + { + _logger.LogCritical("[Account] Email validation error: {Message}", error.Description); } - return true; + return false; + } } } diff --git a/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.html b/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.html index f52e1afc0..184b92302 100644 --- a/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.html +++ b/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.html @@ -9,6 +9,8 @@ [isLoading]="loadingBookmarks" [items]="series" [trackByIdentity]="trackByIdentity" + [refresh]="refresh" + > [] = []; trackByIdentity = (index: number, item: Series) => `${item.name}_${item.localizedName}_${item.pagesRead}`; + refresh: EventEmitter = new EventEmitter(); private onDestroy: Subject = new Subject(); @@ -153,6 +154,7 @@ export class BookmarksComponent implements OnInit, OnDestroy { } this.clearingSeries[series.id] = false; this.toastr.success(series.name + '\'s bookmarks have been removed'); + this.refresh.emit(); this.cdRef.markForCheck(); }); } diff --git a/UI/Web/src/app/cards/bulk-selection.service.ts b/UI/Web/src/app/cards/bulk-selection.service.ts index 94d268e77..326aba869 100644 --- a/UI/Web/src/app/cards/bulk-selection.service.ts +++ b/UI/Web/src/app/cards/bulk-selection.service.ts @@ -146,14 +146,7 @@ export class BulkSelectionService { // else returns volume/chapter items const allowedActions = [Action.AddToReadingList, Action.MarkAsRead, Action.MarkAsUnread, Action.AddToCollection, Action.Delete, Action.AddToWantToReadList, Action.RemoveFromWantToReadList]; if (Object.keys(this.selectedCards).filter(item => item === 'series').length > 0) { - let actions = this.actionFactory.getSeriesActions(callback).filter(item => allowedActions.includes(item.action)); - if (this.activeRoute.startsWith('/want-to-read')) { - const removeFromWantToRead = {...actions[0]}; - removeFromWantToRead.action = Action.RemoveFromWantToReadList; - removeFromWantToRead.title = 'Remove from Want to Read'; - actions.push(removeFromWantToRead); - } - return actions; + return this.actionFactory.getSeriesActions(callback).filter(item => allowedActions.includes(item.action)); } if (Object.keys(this.selectedCards).filter(item => item === 'bookmark').length > 0) { diff --git a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.ts b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.ts index 90232c554..2e31fff40 100644 --- a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.ts +++ b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.ts @@ -44,6 +44,7 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy, OnChanges, @Input() actions: ActionItem[] = []; @Input() trackByIdentity!: TrackByFunction; //(index: number, item: any) => string @Input() filterSettings!: FilterSettings; + @Input() refresh!: EventEmitter; @Input() jumpBarKeys: Array = []; // This is aprox 784 pixels wide @@ -100,6 +101,13 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy, OnChanges, this.pagination = {currentPage: 1, itemsPerPage: this.items.length, totalItems: this.items.length, totalPages: 1}; this.changeDetectionRef.markForCheck(); } + + if (this.refresh) { + this.refresh.subscribe(() => { + this.changeDetectionRef.markForCheck(); + this.virtualScroller.refresh(); + }); + } } ngAfterViewInit(): void { diff --git a/UI/Web/src/app/cards/series-card/series-card.component.ts b/UI/Web/src/app/cards/series-card/series-card.component.ts index e72e5f6df..d7b1c98bd 100644 --- a/UI/Web/src/app/cards/series-card/series-card.component.ts +++ b/UI/Web/src/app/cards/series-card/series-card.component.ts @@ -1,8 +1,8 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output } from '@angular/core'; -import { Router } from '@angular/router'; +import { NavigationStart, Router } from '@angular/router'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrService } from 'ngx-toastr'; -import { take } from 'rxjs/operators'; +import { filter, take } from 'rxjs/operators'; import { Series } from 'src/app/_models/series'; import { AccountService } from 'src/app/_services/account.service'; import { ImageService } from 'src/app/_services/image.service'; @@ -102,6 +102,9 @@ export class SeriesCardComponent implements OnInit, OnChanges, OnDestroy { break; case Action.RemoveFromWantToReadList: this.actionService.removeMultipleSeriesFromWantToReadList([series.id]); + if (this.router.url.startsWith('/want-to-read')) { + this.reload.emit(true); + } break; case(Action.AddToCollection): this.actionService.addMultipleSeriesToCollectionTag([series]); diff --git a/UI/Web/src/app/reading-list/draggable-ordered-list/draggable-ordered-list.component.html b/UI/Web/src/app/reading-list/draggable-ordered-list/draggable-ordered-list.component.html index cfce2cd03..a2eaf43a8 100644 --- a/UI/Web/src/app/reading-list/draggable-ordered-list/draggable-ordered-list.component.html +++ b/UI/Web/src/app/reading-list/draggable-ordered-list/draggable-ordered-list.component.html @@ -1,4 +1,5 @@
+
diff --git a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html index a09ded135..6cc8c45b3 100644 --- a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html +++ b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html @@ -18,12 +18,18 @@
- +
+
diff --git a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts index 1c23e2fea..d2ae20323 100644 --- a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts +++ b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts @@ -176,6 +176,12 @@ export class ReadingListDetailComponent implements OnInit { } read() { + if (!this.readingList) return; + const firstItem = this.items[0]; + this.router.navigate(this.readerService.getNavigationArray(firstItem.libraryId, firstItem.seriesId, firstItem.chapterId, firstItem.seriesFormat), {queryParams: {readingListId: this.readingList.id}}); + } + + continue() { // TODO: Can I do this in the backend? if (!this.readingList) return; let currentlyReadingChapter = this.items[0]; diff --git a/UI/Web/src/app/series-detail/series-detail.component.ts b/UI/Web/src/app/series-detail/series-detail.component.ts index 8967929d3..5c0c81232 100644 --- a/UI/Web/src/app/series-detail/series-detail.component.ts +++ b/UI/Web/src/app/series-detail/series-detail.component.ts @@ -384,6 +384,12 @@ export class SeriesDetailComponent implements OnInit, OnDestroy, AfterContentChe this.changeDetectionRef.markForCheck(); }); break; + case Action.RemoveFromWantToReadList: + this.actionService.removeMultipleSeriesFromWantToReadList([series.id], () => { + this.actionInProgress = false; + this.changeDetectionRef.markForCheck(); + }); + break; case (Action.Download): if (this.downloadInProgress) return; this.downloadSeries(); diff --git a/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.html b/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.html index 3e37386a4..9a6a95ad4 100644 --- a/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.html +++ b/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.html @@ -5,6 +5,7 @@ Want To Read +
{{seriesPagination.totalItems}} Series
diff --git a/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.ts b/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.ts index 0c4a0c3e7..a6f70316d 100644 --- a/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.ts +++ b/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.ts @@ -42,7 +42,6 @@ export class WantToReadComponent implements OnInit, OnDestroy { jumpbarKeys: Array = []; filterOpen: EventEmitter = new EventEmitter(); - private onDestory: Subject = new Subject(); trackByIdentity = (index: number, item: Series) => `${item.name}_${item.localizedName}_${item.pagesRead}`;