mirror of https://github.com/usbharu/Hideout.git
fix: リファクタリングで壊れた部分を修正
This commit is contained in:
parent
6904bc0692
commit
c52d157696
|
@ -39,8 +39,8 @@ class GetActorDetailApplicationService(
|
||||||
throw IllegalArgumentException("id and actorName are null.")
|
throw IllegalArgumentException("id and actorName are null.")
|
||||||
}
|
}
|
||||||
|
|
||||||
val iconUrl = actor.icon?.let { mediaRepository.findById(it)?.url }
|
val iconUrl = actor.icon?.let { mediaRepository.findById(it) }
|
||||||
val bannerUrl = actor.banner?.let { mediaRepository.findById(it)?.url }
|
val bannerUrl = actor.banner?.let { mediaRepository.findById(it) }
|
||||||
|
|
||||||
return ActorDetail.of(actor, iconUrl, bannerUrl)
|
return ActorDetail.of(actor, iconUrl, bannerUrl)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package dev.usbharu.hideout.core.application.application
|
package dev.usbharu.hideout.core.application.application
|
||||||
|
|
||||||
import dev.usbharu.hideout.core.application.model.Application
|
|
||||||
import dev.usbharu.hideout.core.application.shared.AbstractApplicationService
|
import dev.usbharu.hideout.core.application.shared.AbstractApplicationService
|
||||||
import dev.usbharu.hideout.core.application.shared.Transaction
|
import dev.usbharu.hideout.core.application.shared.Transaction
|
||||||
import dev.usbharu.hideout.core.domain.model.application.Application
|
import dev.usbharu.hideout.core.domain.model.application.Application
|
||||||
|
|
|
@ -9,7 +9,8 @@ data class ActorDetail(
|
||||||
val name: String,
|
val name: String,
|
||||||
val screenName: String,
|
val screenName: String,
|
||||||
val host: String,
|
val host: String,
|
||||||
val remoteUrl: String?,
|
val instanceId: Long,
|
||||||
|
val remoteUrl: URI?,
|
||||||
val locked: Boolean,
|
val locked: Boolean,
|
||||||
val description: String,
|
val description: String,
|
||||||
val postsCount: Int,
|
val postsCount: Int,
|
||||||
|
@ -25,7 +26,8 @@ data class ActorDetail(
|
||||||
name = actor.name.name,
|
name = actor.name.name,
|
||||||
screenName = actor.screenName.screenName,
|
screenName = actor.screenName.screenName,
|
||||||
host = actor.url.host,
|
host = actor.url.host,
|
||||||
remoteUrl = actor.url.toString(),
|
instanceId = actor.instance.instanceId,
|
||||||
|
remoteUrl = actor.url,
|
||||||
locked = actor.locked,
|
locked = actor.locked,
|
||||||
description = actor.description.description,
|
description = actor.description.description,
|
||||||
postsCount = actor.postsCount.postsCount,
|
postsCount = actor.postsCount.postsCount,
|
||||||
|
|
|
@ -56,15 +56,15 @@ class ExposedUserTimelineQueryService : UserTimelineQueryService, AbstractReposi
|
||||||
val iconMedia = Media.alias("ICON_MEDIA")
|
val iconMedia = Media.alias("ICON_MEDIA")
|
||||||
|
|
||||||
return authorizedQuery
|
return authorizedQuery
|
||||||
.leftJoin(PostsVisibleActors, { authorizedQuery[Posts.id] }, { PostsVisibleActors.postId })
|
.leftJoin(PostsVisibleActors, { authorizedQuery[Posts.id] }, { postId })
|
||||||
.leftJoin(Actors, { authorizedQuery[Posts.actorId] }, { Actors.id })
|
.leftJoin(Actors, { authorizedQuery[Posts.actorId] }, { id })
|
||||||
.leftJoin(iconMedia, { Actors.icon }, { iconMedia[Media.id] })
|
.leftJoin(iconMedia, { Actors.icon }, { iconMedia[Media.id] })
|
||||||
.leftJoin(PostsMedia, { authorizedQuery[Posts.id] }, { PostsMedia.postId })
|
.leftJoin(PostsMedia, { authorizedQuery[Posts.id] }, { postId })
|
||||||
.leftJoin(Media, { PostsMedia.mediaId }, { Media.id })
|
.leftJoin(Media, { PostsMedia.mediaId }, { id })
|
||||||
.leftJoin(
|
.leftJoin(
|
||||||
Reactions,
|
Reactions,
|
||||||
{ authorizedQuery[Posts.id] },
|
{ authorizedQuery[Posts.id] },
|
||||||
{ Reactions.postId },
|
{ postId },
|
||||||
{ Reactions.id isDistinctFrom principal.actorId.id }
|
{ Reactions.id isDistinctFrom principal.actorId.id }
|
||||||
)
|
)
|
||||||
.selectAll()
|
.selectAll()
|
||||||
|
@ -85,14 +85,19 @@ class ExposedUserTimelineQueryService : UserTimelineQueryService, AbstractReposi
|
||||||
return PostDetail(
|
return PostDetail(
|
||||||
id = it[authorizedQuery[Posts.id]],
|
id = it[authorizedQuery[Posts.id]],
|
||||||
actor = ActorDetail(
|
actor = ActorDetail(
|
||||||
actorId = it[authorizedQuery[Posts.actorId]],
|
id = it[authorizedQuery[Posts.actorId]],
|
||||||
instanceId = it[Actors.instance],
|
instanceId = it[Actors.instance],
|
||||||
name = it[Actors.name],
|
name = it[Actors.name],
|
||||||
domain = it[Actors.domain],
|
host = it[Actors.domain],
|
||||||
screenName = it[Actors.screenName],
|
screenName = it[Actors.screenName],
|
||||||
url = it[Actors.url],
|
remoteUrl = it[Actors.url],
|
||||||
locked = it[Actors.locked],
|
locked = it[Actors.locked],
|
||||||
icon = it.getOrNull(iconMedia[Media.url])
|
iconUrl = it.getOrNull(iconMedia[Media.url]),
|
||||||
|
description = it[Actors.description],
|
||||||
|
postsCount = it[Actors.postsCount],
|
||||||
|
bannerURL = null,
|
||||||
|
followingCount = it[Actors.followingCount],
|
||||||
|
followersCount = it[Actors.followersCount],
|
||||||
),
|
),
|
||||||
overview = it[authorizedQuery[Posts.overview]],
|
overview = it[authorizedQuery[Posts.overview]],
|
||||||
text = it[authorizedQuery[Posts.text]],
|
text = it[authorizedQuery[Posts.text]],
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
<article class="post" th:fragment="single-simple-post(post)">
|
<article class="post" th:fragment="single-simple-post(post)">
|
||||||
<!--/*@thymesVar id="post" type="dev.usbharu.hideout.core.application.model.PostDetail"*/-->
|
<!--/*@thymesVar id="post" type="dev.usbharu.hideout.core.application.model.PostDetail"*/-->
|
||||||
<img alt="" height="80px" src="" th:src="${post.actor.icon}" width="80px">
|
<img alt="" height="80px" src="" th:src="${post.actor.iconUrl}" width="80px">
|
||||||
<div style="display: inline-block">
|
<div style="display: inline-block">
|
||||||
<a th:href="${post.actor.url}"
|
<a th:href="${post.actor.remoteUrl}"
|
||||||
th:text="${post.actor.screenName}+'(@'+${post.actor.name}+'@'+${post.actor.domain}+')'"></a>
|
th:text="${post.actor.screenName}+'(@'+${post.actor.name}+'@'+${post.actor.host}+')'"></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:utext="${post.content}">
|
<div th:utext="${post.content}">
|
||||||
|
|
|
@ -18,7 +18,6 @@ package dev.usbharu.hideout.mastodon.interfaces.api
|
||||||
|
|
||||||
import dev.usbharu.hideout.core.application.media.UploadMedia
|
import dev.usbharu.hideout.core.application.media.UploadMedia
|
||||||
import dev.usbharu.hideout.core.application.media.UploadMediaApplicationService
|
import dev.usbharu.hideout.core.application.media.UploadMediaApplicationService
|
||||||
import dev.usbharu.hideout.core.domain.model.media.FileType.*
|
|
||||||
import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.SpringSecurityOauth2PrincipalContextHolder
|
import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.SpringSecurityOauth2PrincipalContextHolder
|
||||||
import dev.usbharu.hideout.mastodon.interfaces.api.generated.MediaApi
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.MediaApi
|
||||||
import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.MediaAttachment
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.MediaAttachment
|
||||||
|
@ -58,18 +57,18 @@ class SpringMediaApi(
|
||||||
|
|
||||||
return ResponseEntity.ok(
|
return ResponseEntity.ok(
|
||||||
MediaAttachment(
|
MediaAttachment(
|
||||||
id = media.id.toString(),
|
id = media.mediaId.toString(),
|
||||||
type = when (media.type) {
|
type = when (media.type) {
|
||||||
Image -> MediaAttachment.Type.image
|
"Image" -> MediaAttachment.Type.image
|
||||||
Video -> MediaAttachment.Type.video
|
"Video" -> MediaAttachment.Type.video
|
||||||
Audio -> MediaAttachment.Type.audio
|
"Audio" -> MediaAttachment.Type.audio
|
||||||
Unknown -> MediaAttachment.Type.unknown
|
else -> MediaAttachment.Type.unknown
|
||||||
},
|
},
|
||||||
url = media.url.toString(),
|
url = media.url.toString(),
|
||||||
previewUrl = media.thumbprintURI?.toString(),
|
previewUrl = media.thumbnailUrl?.toString(),
|
||||||
remoteUrl = media.remoteURL?.toString(),
|
remoteUrl = null,
|
||||||
description = media.description,
|
description = media.description,
|
||||||
blurhash = media.blurHash,
|
blurhash = media.blurhash,
|
||||||
textUrl = media.url.toASCIIString()
|
textUrl = media.url.toASCIIString()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue