From 90de87a49f1bb0eafc8d7e72989ac894193cbbce Mon Sep 17 00:00:00 2001 From: Joseph Milazzo Date: Sat, 5 Feb 2022 17:06:28 -0800 Subject: [PATCH] Fixes (#1037) * When downloading bookmarks, prepend the images with chapterId to ensure there are no conflicts. * Fixed a case where email service wasn't using the custom email service. * Changed how we render some text in search results * Update the recently when we receive scan events --- API/Controllers/DownloadController.cs | 3 ++- API/Services/EmailService.cs | 3 ++- UI/Web/src/app/library/library.component.html | 7 ------- UI/Web/src/app/library/library.component.ts | 20 ++++++------------- .../app/nav-header/nav-header.component.html | 10 +++++++--- 5 files changed, 17 insertions(+), 26 deletions(-) diff --git a/API/Controllers/DownloadController.cs b/API/Controllers/DownloadController.cs index b840c0cbb..1a926a172 100644 --- a/API/Controllers/DownloadController.cs +++ b/API/Controllers/DownloadController.cs @@ -154,10 +154,11 @@ namespace API.Controllers var bookmarkDirectory = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.BookmarkDirectory)).Value; + var files = (await _unitOfWork.UserRepository.GetAllBookmarksByIds(downloadBookmarkDto.Bookmarks .Select(b => b.Id) .ToList())) - .Select(b => Parser.Parser.NormalizePath(_directoryService.FileSystem.Path.Join(bookmarkDirectory, b.FileName))); + .Select(b => Parser.Parser.NormalizePath(_directoryService.FileSystem.Path.Join(bookmarkDirectory, $"{b.ChapterId}_{b.FileName}"))); var (fileBytes, _) = await _archiveService.CreateZipForDownload(files, $"download_{user.Id}_{series.Id}_bookmarks"); diff --git a/API/Services/EmailService.cs b/API/Services/EmailService.cs index 2aa19b34b..676e897b3 100644 --- a/API/Services/EmailService.cs +++ b/API/Services/EmailService.cs @@ -50,7 +50,8 @@ public class EmailService : IEmailService public async Task SendConfirmationEmail(ConfirmationEmailDto data) { - var success = await SendEmailWithPost(DefaultApiUrl + "/api/email/confirm", data); + var emailLink = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.EmailServiceUrl)).Value; + var success = await SendEmailWithPost(emailLink + "/api/email/confirm", data); if (!success) { _logger.LogError("There was a critical error sending Confirmation email"); diff --git a/UI/Web/src/app/library/library.component.html b/UI/Web/src/app/library/library.component.html index 63a07cce2..ac79f074c 100644 --- a/UI/Web/src/app/library/library.component.html +++ b/UI/Web/src/app/library/library.component.html @@ -18,13 +18,6 @@ - - - { if (res.event === EVENTS.SeriesAdded) { const seriesAddedEvent = res.payload as SeriesAddedEvent; - this.seriesService.getSeries(seriesAddedEvent.seriesId).subscribe(series => { - this.recentlyAdded.unshift(series); - }); - this.loadRecentlyAddedChapters(); + this.loadRecentlyAdded(); } else if (res.event === EVENTS.SeriesRemoved) { const seriesRemovedEvent = res.payload as SeriesRemovedEvent; - this.recentlyAdded = this.recentlyAdded.filter(item => item.id != seriesRemovedEvent.seriesId); this.inProgress = this.inProgress.filter(item => item.id != seriesRemovedEvent.seriesId); this.recentlyUpdatedSeries = this.recentlyUpdatedSeries.filter(item => item.seriesId != seriesRemovedEvent.seriesId); this.recentlyAddedChapters = this.recentlyAddedChapters.filter(item => item.seriesId != seriesRemovedEvent.seriesId); + } else if (res.event === EVENTS.ScanSeries) { + // We don't have events for when series are updated, but we do get events when a scan update occurs. Refresh recentlyAdded at that time. + this.loadRecentlyAdded(); } }); } @@ -80,9 +78,8 @@ export class LibraryComponent implements OnInit, OnDestroy { } reloadSeries() { - this.loadRecentlyAdded(); this.loadOnDeck(); - this.loadRecentlyAddedChapters(); + this.loadRecentlyAdded(); } reloadInProgress(series: Series | boolean) { @@ -104,13 +101,8 @@ export class LibraryComponent implements OnInit, OnDestroy { }); } - loadRecentlyAdded() { - this.seriesService.getRecentlyAdded(0, 0, 20).pipe(takeUntil(this.onDestroy)).subscribe(updatedSeries => { - this.recentlyAdded = updatedSeries.result; - }); - } - loadRecentlyAddedChapters() { + loadRecentlyAdded() { this.seriesService.getRecentlyUpdatedSeries().pipe(takeUntil(this.onDestroy)).subscribe(updatedSeries => { this.recentlyUpdatedSeries = updatedSeries; }); diff --git a/UI/Web/src/app/nav-header/nav-header.component.html b/UI/Web/src/app/nav-header/nav-header.component.html index 56c5d2518..d027e8202 100644 --- a/UI/Web/src/app/nav-header/nav-header.component.html +++ b/UI/Web/src/app/nav-header/nav-header.component.html @@ -29,7 +29,7 @@
- + {{item.name}} @@ -44,7 +44,11 @@
- + {{item.title}} + +   + (promoted) +
@@ -52,7 +56,7 @@
- + {{item.title}}