From b1a7d8adf9a7c3f0bbdef81c6d18f1f9c38b1a45 Mon Sep 17 00:00:00 2001 From: usbharu Date: Thu, 2 Nov 2023 19:56:06 +0900 Subject: [PATCH] Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../hideout/activitypub/service/objects/note/APNoteService.kt | 4 ++-- .../usbharu/hideout/core/service/media/MediaServiceImpl.kt | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/objects/note/APNoteService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/objects/note/APNoteService.kt index dd2ec6ae..0fdee80b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/objects/note/APNoteService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/objects/note/APNoteService.kt @@ -126,14 +126,14 @@ class APNoteServiceImpl( postQueryService.findByUrl(it) } - val mediaList = note.attachment .filter { it.url != null } .map { mediaService.uploadRemoteMedia( RemoteMedia( (it.name ?: it.url)!!, - it.url!!, it.mediaType ?: "application/octet-stream" + it.url!!, + it.mediaType ?: "application/octet-stream" ) ) } diff --git a/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaServiceImpl.kt index aefbc05e..ca0f1387 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaServiceImpl.kt @@ -95,7 +95,6 @@ class MediaServiceImpl( ) } - // TODO: 仮の処理として保存したように動かす override suspend fun uploadRemoteMedia(remoteMedia: RemoteMedia): Media { logger.info("MEDIA Remote media. filename:${remoteMedia.name} url:${remoteMedia.url}") @@ -145,7 +144,6 @@ class MediaServiceImpl( mediaBlurhashService.generateBlurhash(ImageIO.read(bytes.inputStream())) } - return mediaRepository.save( EntityMedia( id = mediaRepository.generateId(), @@ -159,7 +157,6 @@ class MediaServiceImpl( ) } - companion object { private val logger = LoggerFactory.getLogger(MediaServiceImpl::class.java) }