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.")
|
||||
}
|
||||
|
||||
val iconUrl = actor.icon?.let { mediaRepository.findById(it)?.url }
|
||||
val bannerUrl = actor.banner?.let { mediaRepository.findById(it)?.url }
|
||||
val iconUrl = actor.icon?.let { mediaRepository.findById(it) }
|
||||
val bannerUrl = actor.banner?.let { mediaRepository.findById(it) }
|
||||
|
||||
return ActorDetail.of(actor, iconUrl, bannerUrl)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
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.Transaction
|
||||
import dev.usbharu.hideout.core.domain.model.application.Application
|
||||
|
|
|
@ -9,7 +9,8 @@ data class ActorDetail(
|
|||
val name: String,
|
||||
val screenName: String,
|
||||
val host: String,
|
||||
val remoteUrl: String?,
|
||||
val instanceId: Long,
|
||||
val remoteUrl: URI?,
|
||||
val locked: Boolean,
|
||||
val description: String,
|
||||
val postsCount: Int,
|
||||
|
@ -25,7 +26,8 @@ data class ActorDetail(
|
|||
name = actor.name.name,
|
||||
screenName = actor.screenName.screenName,
|
||||
host = actor.url.host,
|
||||
remoteUrl = actor.url.toString(),
|
||||
instanceId = actor.instance.instanceId,
|
||||
remoteUrl = actor.url,
|
||||
locked = actor.locked,
|
||||
description = actor.description.description,
|
||||
postsCount = actor.postsCount.postsCount,
|
||||
|
|
|
@ -42,10 +42,10 @@ class ExposedUserTimelineQueryService : UserTimelineQueryService, AbstractReposi
|
|||
.select(Posts.columns)
|
||||
.where {
|
||||
Posts.visibility eq Visibility.PUBLIC.name or
|
||||
(Posts.visibility eq Visibility.UNLISTED.name) or
|
||||
(Posts.visibility eq Visibility.DIRECT.name and (PostsVisibleActors.actorId eq principal.actorId.id)) or
|
||||
(Posts.visibility eq Visibility.FOLLOWERS.name and (Relationships.blocking eq false and (relationshipsAlias[Relationships.following] eq true))) or
|
||||
(Posts.actorId eq principal.actorId.id)
|
||||
(Posts.visibility eq Visibility.UNLISTED.name) or
|
||||
(Posts.visibility eq Visibility.DIRECT.name and (PostsVisibleActors.actorId eq principal.actorId.id)) or
|
||||
(Posts.visibility eq Visibility.FOLLOWERS.name and (Relationships.blocking eq false and (relationshipsAlias[Relationships.following] eq true))) or
|
||||
(Posts.actorId eq principal.actorId.id)
|
||||
}
|
||||
.alias("authorized_table")
|
||||
}
|
||||
|
@ -56,15 +56,15 @@ class ExposedUserTimelineQueryService : UserTimelineQueryService, AbstractReposi
|
|||
val iconMedia = Media.alias("ICON_MEDIA")
|
||||
|
||||
return authorizedQuery
|
||||
.leftJoin(PostsVisibleActors, { authorizedQuery[Posts.id] }, { PostsVisibleActors.postId })
|
||||
.leftJoin(Actors, { authorizedQuery[Posts.actorId] }, { Actors.id })
|
||||
.leftJoin(PostsVisibleActors, { authorizedQuery[Posts.id] }, { postId })
|
||||
.leftJoin(Actors, { authorizedQuery[Posts.actorId] }, { id })
|
||||
.leftJoin(iconMedia, { Actors.icon }, { iconMedia[Media.id] })
|
||||
.leftJoin(PostsMedia, { authorizedQuery[Posts.id] }, { PostsMedia.postId })
|
||||
.leftJoin(Media, { PostsMedia.mediaId }, { Media.id })
|
||||
.leftJoin(PostsMedia, { authorizedQuery[Posts.id] }, { postId })
|
||||
.leftJoin(Media, { PostsMedia.mediaId }, { id })
|
||||
.leftJoin(
|
||||
Reactions,
|
||||
{ authorizedQuery[Posts.id] },
|
||||
{ Reactions.postId },
|
||||
{ postId },
|
||||
{ Reactions.id isDistinctFrom principal.actorId.id }
|
||||
)
|
||||
.selectAll()
|
||||
|
@ -85,14 +85,19 @@ class ExposedUserTimelineQueryService : UserTimelineQueryService, AbstractReposi
|
|||
return PostDetail(
|
||||
id = it[authorizedQuery[Posts.id]],
|
||||
actor = ActorDetail(
|
||||
actorId = it[authorizedQuery[Posts.actorId]],
|
||||
id = it[authorizedQuery[Posts.actorId]],
|
||||
instanceId = it[Actors.instance],
|
||||
name = it[Actors.name],
|
||||
domain = it[Actors.domain],
|
||||
host = it[Actors.domain],
|
||||
screenName = it[Actors.screenName],
|
||||
url = it[Actors.url],
|
||||
remoteUrl = it[Actors.url],
|
||||
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]],
|
||||
text = it[authorizedQuery[Posts.text]],
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
<article class="post" th:fragment="single-simple-post(post)">
|
||||
<!--/*@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">
|
||||
<a th:href="${post.actor.url}"
|
||||
th:text="${post.actor.screenName}+'(@'+${post.actor.name}+'@'+${post.actor.domain}+')'"></a>
|
||||
<a th:href="${post.actor.remoteUrl}"
|
||||
th:text="${post.actor.screenName}+'(@'+${post.actor.name}+'@'+${post.actor.host}+')'"></a>
|
||||
</div>
|
||||
|
||||
<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.UploadMediaApplicationService
|
||||
import dev.usbharu.hideout.core.domain.model.media.FileType.*
|
||||
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.model.MediaAttachment
|
||||
|
@ -58,18 +57,18 @@ class SpringMediaApi(
|
|||
|
||||
return ResponseEntity.ok(
|
||||
MediaAttachment(
|
||||
id = media.id.toString(),
|
||||
id = media.mediaId.toString(),
|
||||
type = when (media.type) {
|
||||
Image -> MediaAttachment.Type.image
|
||||
Video -> MediaAttachment.Type.video
|
||||
Audio -> MediaAttachment.Type.audio
|
||||
Unknown -> MediaAttachment.Type.unknown
|
||||
"Image" -> MediaAttachment.Type.image
|
||||
"Video" -> MediaAttachment.Type.video
|
||||
"Audio" -> MediaAttachment.Type.audio
|
||||
else -> MediaAttachment.Type.unknown
|
||||
},
|
||||
url = media.url.toString(),
|
||||
previewUrl = media.thumbprintURI?.toString(),
|
||||
remoteUrl = media.remoteURL?.toString(),
|
||||
previewUrl = media.thumbnailUrl?.toString(),
|
||||
remoteUrl = null,
|
||||
description = media.description,
|
||||
blurhash = media.blurHash,
|
||||
blurhash = media.blurhash,
|
||||
textUrl = media.url.toASCIIString()
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue