mirror of https://github.com/usbharu/Hideout.git
Apply suggestions from code review
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
35d126703b
commit
7b9ef770da
|
@ -15,4 +15,6 @@ open class Announce @JsonCreator constructor(
|
||||||
val cc: List<String> = emptyList()
|
val cc: List<String> = emptyList()
|
||||||
) : Object(
|
) : Object(
|
||||||
type = add(type, "Announce")
|
type = add(type, "Announce")
|
||||||
), HasActor, HasId
|
),
|
||||||
|
HasActor,
|
||||||
|
HasId
|
|
@ -35,7 +35,6 @@ class ExposedAnnounceQueryService(
|
||||||
?.let { (it.toAnnounce() ?: return null) to (postResultRowMapper.map(it)) }
|
?.let { (it.toAnnounce() ?: return null) to (postResultRowMapper.map(it)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private suspend fun ResultRow.toAnnounce(): Announce? {
|
private suspend fun ResultRow.toAnnounce(): Announce? {
|
||||||
val repostId = this[Posts.repostId] ?: return null
|
val repostId = this[Posts.repostId] ?: return null
|
||||||
val repost = postRepository.findById(repostId)?.url ?: return null
|
val repost = postRepository.findById(repostId)?.url ?: return null
|
||||||
|
|
|
@ -66,7 +66,8 @@ class NoteQueryServiceImpl(private val postRepository: PostRepository, private v
|
||||||
logger.warn("Failed to get repostId: $repostId")
|
logger.warn("Failed to get repostId: $repostId")
|
||||||
}
|
}
|
||||||
url
|
url
|
||||||
}else{
|
}
|
||||||
|
else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,6 @@ class APNoteServiceImpl(
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun fetchAnnounce(announce: Announce, signerId: Long?): Pair<Announce, Post> {
|
override suspend fun fetchAnnounce(announce: Announce, signerId: Long?): Pair<Announce, Post> {
|
||||||
|
|
||||||
val findByApId = announceQueryService.findByApId(announce.id)
|
val findByApId = announceQueryService.findByApId(announce.id)
|
||||||
|
|
||||||
if (findByApId != null) {
|
if (findByApId != null) {
|
||||||
|
@ -227,7 +226,6 @@ class APNoteServiceImpl(
|
||||||
mediaIds = mediaList,
|
mediaIds = mediaList,
|
||||||
emojiIds = emojis
|
emojiIds = emojis
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val createRemote = postService.createRemote(
|
val createRemote = postService.createRemote(
|
||||||
|
|
|
@ -98,7 +98,6 @@ data class Post private constructor(
|
||||||
repost: Post,
|
repost: Post,
|
||||||
apId: String
|
apId: String
|
||||||
): Post {
|
): Post {
|
||||||
|
|
||||||
// リポストの公開範囲は元のポストより広くてはいけない
|
// リポストの公開範囲は元のポストより広くてはいけない
|
||||||
val fixedVisibility = if (visibility.ordinal <= repost.visibility.ordinal) {
|
val fixedVisibility = if (visibility.ordinal <= repost.visibility.ordinal) {
|
||||||
repost.visibility
|
repost.visibility
|
||||||
|
@ -110,7 +109,6 @@ data class Post private constructor(
|
||||||
|
|
||||||
require(actorId >= 0) { "actorId must be greater than or equal to 0." }
|
require(actorId >= 0) { "actorId must be greater than or equal to 0." }
|
||||||
|
|
||||||
|
|
||||||
return Post(
|
return Post(
|
||||||
id,
|
id,
|
||||||
actorId,
|
actorId,
|
||||||
|
@ -145,7 +143,6 @@ data class Post private constructor(
|
||||||
mediaIds: List<Long> = emptyList(),
|
mediaIds: List<Long> = emptyList(),
|
||||||
emojiIds: List<Long> = emptyList()
|
emojiIds: List<Long> = emptyList()
|
||||||
): Post {
|
): Post {
|
||||||
|
|
||||||
// リポストの公開範囲は元のポストより広くてはいけない
|
// リポストの公開範囲は元のポストより広くてはいけない
|
||||||
val fixedVisibility = if (visibility.ordinal <= repost.visibility.ordinal) {
|
val fixedVisibility = if (visibility.ordinal <= repost.visibility.ordinal) {
|
||||||
repost.visibility
|
repost.visibility
|
||||||
|
|
Loading…
Reference in New Issue