mirror of https://github.com/usbharu/Hideout.git
style: fix lint (CI)
This commit is contained in:
parent
ed41c025cf
commit
5036e01c89
|
@ -35,4 +35,4 @@ data class ActorDetail(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,14 @@ class GetActorDetailApplicationService(
|
||||||
transaction: Transaction
|
transaction: Transaction
|
||||||
) :
|
) :
|
||||||
AbstractApplicationService<GetActorDetail, ActorDetail>(
|
AbstractApplicationService<GetActorDetail, ActorDetail>(
|
||||||
transaction, logger
|
transaction,
|
||||||
|
logger
|
||||||
) {
|
) {
|
||||||
override suspend fun internalExecute(command: GetActorDetail, principal: Principal): ActorDetail {
|
override suspend fun internalExecute(command: GetActorDetail, principal: Principal): ActorDetail {
|
||||||
val actor = if (command.id != null) {
|
val actor = if (command.id != null) {
|
||||||
actorRepository.findById(ActorId(command.id))
|
actorRepository.findById(ActorId(command.id))
|
||||||
?: throw IllegalArgumentException("Actor ${command.id} not found.")
|
?: throw IllegalArgumentException("Actor ${command.id} not found.")
|
||||||
} else if (command.actorName != null) {
|
} else if (command.actorName != null) {
|
||||||
|
|
||||||
val host = if (command.actorName.host.isEmpty()) {
|
val host = if (command.actorName.host.isEmpty()) {
|
||||||
applicationConfig.url.host
|
applicationConfig.url.host
|
||||||
} else {
|
} else {
|
||||||
|
@ -46,4 +46,4 @@ class GetActorDetailApplicationService(
|
||||||
companion object {
|
companion object {
|
||||||
private val logger = LoggerFactory.getLogger(GetActorDetailApplicationService::class.java)
|
private val logger = LoggerFactory.getLogger(GetActorDetailApplicationService::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,9 @@ class GetLocalInstanceApplicationService(
|
||||||
}
|
}
|
||||||
|
|
||||||
val instance = (
|
val instance = (
|
||||||
instanceRepository.findByUrl(applicationConfig.url.toURI())
|
instanceRepository.findByUrl(applicationConfig.url.toURI())
|
||||||
?: throw InternalServerException("Local instance not found.")
|
?: throw InternalServerException("Local instance not found.")
|
||||||
)
|
)
|
||||||
|
|
||||||
cachedInstance = Instance.of(instance)
|
cachedInstance = Instance.of(instance)
|
||||||
@Suppress("UnsafeCallOnNullableType")
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
|
|
|
@ -35,15 +35,18 @@ class GetUserTimelineApplicationService(
|
||||||
|
|
||||||
val postDetailMap = userTimelineQueryService.findByIdAll(postIdList, principal).associateBy { it.id }
|
val postDetailMap = userTimelineQueryService.findByIdAll(postIdList, principal).associateBy { it.id }
|
||||||
|
|
||||||
return PaginationList(postList.mapNotNull {
|
return PaginationList(
|
||||||
postDetailMap[it.id.id]?.copy(
|
postList.mapNotNull {
|
||||||
repost = postDetailMap[it.repostId?.id],
|
postDetailMap[it.id.id]?.copy(
|
||||||
reply = postDetailMap[it.replyId?.id]
|
repost = postDetailMap[it.repostId?.id],
|
||||||
)
|
reply = postDetailMap[it.replyId?.id]
|
||||||
}, postList.next, postList.prev)
|
)
|
||||||
|
},
|
||||||
|
postList.next, postList.prev
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val logger = LoggerFactory.getLogger(GetUserTimelineApplicationService::class.java)
|
private val logger = LoggerFactory.getLogger(GetUserTimelineApplicationService::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,4 +25,4 @@ class MessageSourceConfig {
|
||||||
fun messageSourceProperties(): MessageSourceProperties {
|
fun messageSourceProperties(): MessageSourceProperties {
|
||||||
return MessageSourceProperties()
|
return MessageSourceProperties()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ class ExposedUserTimelineQueryService : UserTimelineQueryService, AbstractReposi
|
||||||
.select(Posts.columns)
|
.select(Posts.columns)
|
||||||
.where {
|
.where {
|
||||||
Posts.visibility eq Visibility.PUBLIC.name or
|
Posts.visibility eq Visibility.PUBLIC.name or
|
||||||
(Posts.visibility eq Visibility.UNLISTED.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.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.visibility eq Visibility.FOLLOWERS.name and (Relationships.blocking eq false and (relationshipsAlias[Relationships.following] eq true))) or
|
||||||
(Posts.actorId eq principal.actorId.id)
|
(Posts.actorId eq principal.actorId.id)
|
||||||
}
|
}
|
||||||
.alias("authorized_table")
|
.alias("authorized_table")
|
||||||
}
|
}
|
||||||
|
@ -107,4 +107,4 @@ class ExposedUserTimelineQueryService : UserTimelineQueryService, AbstractReposi
|
||||||
companion object {
|
companion object {
|
||||||
private val logger = LoggerFactory.getLogger(ExposedUserTimelineQueryService::class.java)
|
private val logger = LoggerFactory.getLogger(ExposedUserTimelineQueryService::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import org.springframework.web.servlet.ModelAndView
|
||||||
class SPAInterceptor : HandlerInterceptor {
|
class SPAInterceptor : HandlerInterceptor {
|
||||||
|
|
||||||
override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean {
|
override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean {
|
||||||
|
|
||||||
if (request.getParameter("s") == "f") {
|
if (request.getParameter("s") == "f") {
|
||||||
request.session.setAttribute("s", "f")
|
request.session.setAttribute("s", "f")
|
||||||
} else if (request.getParameter("s") == "t") {
|
} else if (request.getParameter("s") == "t") {
|
||||||
|
@ -37,4 +36,4 @@ class SPAInterceptor : HandlerInterceptor {
|
||||||
modelAndView?.addObject("ogp", ogp)
|
modelAndView?.addObject("ogp", ogp)
|
||||||
modelAndView?.viewName = "index"
|
modelAndView?.viewName = "index"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,4 +25,4 @@ class IndexController(
|
||||||
model.addAttribute("applicationConfig", applicationConfig)
|
model.addAttribute("applicationConfig", applicationConfig)
|
||||||
return "top"
|
return "top"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,15 @@ class UserController(
|
||||||
actorDetail
|
actorDetail
|
||||||
)
|
)
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
"userTimeline", getUserTimelineApplicationService.execute(
|
"userTimeline",
|
||||||
|
getUserTimelineApplicationService.execute(
|
||||||
GetUserTimeline(
|
GetUserTimeline(
|
||||||
actorDetail.id,
|
actorDetail.id,
|
||||||
Page.of(maxId, sinceId, minId, 20)
|
Page.of(maxId, sinceId, minId, 20)
|
||||||
), principal
|
),
|
||||||
|
principal
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return "userById"
|
return "userById"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,4 @@ interface UserTimelineQueryService {
|
||||||
* replyやrepost等はnullになります
|
* replyやrepost等はnullになります
|
||||||
*/
|
*/
|
||||||
suspend fun findByIdAll(idList: List<PostId>, principal: Principal): List<PostDetail>
|
suspend fun findByIdAll(idList: List<PostId>, principal: Principal): List<PostDetail>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue