From c4d686898cf18dab357df46c68be49c01a2c4c02 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Fri, 15 Dec 2023 15:37:03 +0800 Subject: [PATCH] refactor: remove announcement workaround for links --- .../api/rest/AnnouncementController.kt | 12 +----------- .../api/rest/AnnouncementControllerTest.kt | 17 ----------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/AnnouncementController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/AnnouncementController.kt index 66d317607..cb9124238 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/AnnouncementController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/AnnouncementController.kt @@ -38,7 +38,7 @@ class AnnouncementController( fun getAnnouncements( @AuthenticationPrincipal principal: KomgaPrincipal, ): JsonFeedDto { - return cache.get("announcements") { fetchWebsiteAnnouncements()?.let { replaceLinks(it) } } + return cache.get("announcements") { fetchWebsiteAnnouncements() } ?.let { feed -> val read = userRepository.findAnnouncementIdsReadByUserId(principal.user.id) feed.copy(items = feed.items.map { item -> item.copy(komgaExtension = JsonFeedDto.KomgaExtensionDto(read.contains(item.id))) }) @@ -63,14 +63,4 @@ class AnnouncementController( .block() return response?.body } - - // while waiting for https://github.com/facebook/docusaurus/issues/9136 - fun replaceLinks(feed: JsonFeedDto): JsonFeedDto = feed.copy( - items = feed.items.map { - it.copy( - contentHtml = - it.contentHtml?.replace("""here""", - """link""", - ) - .doesNotContain( - """