Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
usbharu 2024-02-03 16:15:27 +09:00 committed by GitHub
parent 35d126703b
commit 7b9ef770da
9 changed files with 52 additions and 55 deletions

View File

@ -15,4 +15,6 @@ open class Announce @JsonCreator constructor(
val cc: List<String> = emptyList()
) : Object(
type = add(type, "Announce")
), HasActor, HasId
),
HasActor,
HasId

View File

@ -35,7 +35,6 @@ class ExposedAnnounceQueryService(
?.let { (it.toAnnounce() ?: return null) to (postResultRowMapper.map(it)) }
}
private suspend fun ResultRow.toAnnounce(): Announce? {
val repostId = this[Posts.repostId] ?: return null
val repost = postRepository.findById(repostId)?.url ?: return null

View File

@ -66,7 +66,8 @@ class NoteQueryServiceImpl(private val postRepository: PostRepository, private v
logger.warn("Failed to get repostId: $repostId")
}
url
}else{
}
else {
null
}

View File

@ -100,7 +100,6 @@ class APNoteServiceImpl(
}
override suspend fun fetchAnnounce(announce: Announce, signerId: Long?): Pair<Announce, Post> {
val findByApId = announceQueryService.findByApId(announce.id)
if (findByApId != null) {
@ -227,7 +226,6 @@ class APNoteServiceImpl(
mediaIds = mediaList,
emojiIds = emojis
)
}
val createRemote = postService.createRemote(

View File

@ -98,7 +98,6 @@ data class Post private constructor(
repost: Post,
apId: String
): Post {
// リポストの公開範囲は元のポストより広くてはいけない
val fixedVisibility = if (visibility.ordinal <= repost.visibility.ordinal) {
repost.visibility
@ -110,7 +109,6 @@ data class Post private constructor(
require(actorId >= 0) { "actorId must be greater than or equal to 0." }
return Post(
id,
actorId,
@ -145,7 +143,6 @@ data class Post private constructor(
mediaIds: List<Long> = emptyList(),
emojiIds: List<Long> = emptyList()
): Post {
// リポストの公開範囲は元のポストより広くてはいけない
val fixedVisibility = if (visibility.ordinal <= repost.visibility.ordinal) {
repost.visibility