fix: 公開範囲を修正

This commit is contained in:
usbharu 2023-10-20 12:48:23 +09:00
parent 3fac808293
commit a4481a2ccb
1 changed files with 9 additions and 5 deletions

View File

@ -171,9 +171,9 @@ class APNoteServiceImpl(
attributedTo = user.url, attributedTo = user.url,
content = post.text, content = post.text,
published = Instant.ofEpochMilli(post.createdAt).toString(), published = Instant.ofEpochMilli(post.createdAt).toString(),
to = listOf(public, user.url + "/follower"), to = listOfNotNull(public, user.followers),
sensitive = post.sensitive, sensitive = post.sensitive,
cc = listOf(public, user.url + "/follower"), cc = listOfNotNull(public, user.followers),
inReplyTo = reply?.url inReplyTo = reply?.url
) )
} }
@ -202,17 +202,21 @@ class APNoteServiceImpl(
targetActor targetActor
) )
logger.debug("VISIBILITY url: {} to: {} cc: {}", note.id, note.to, note.cc)
val visibility = val visibility =
if (note.to.contains(public) && note.cc.contains(public)) { if (note.to.contains(public)) {
Visibility.PUBLIC Visibility.PUBLIC
} else if (note.to.find { it.endsWith("/followers") } != null && note.cc.contains(public)) { } else if (note.to.contains(person.second.followers) && note.cc.contains(public)) {
Visibility.UNLISTED Visibility.UNLISTED
} else if (note.to.find { it.endsWith("/followers") } != null) { } else if (note.to.contains(person.second.followers)) {
Visibility.FOLLOWERS Visibility.FOLLOWERS
} else { } else {
Visibility.DIRECT Visibility.DIRECT
} }
logger.debug("VISIBILITY is {} url: {}", visibility.name, note.id)
val reply = note.inReplyTo?.let { val reply = note.inReplyTo?.let {
fetchNote(it, targetActor) fetchNote(it, targetActor)
postQueryService.findByUrl(it) postQueryService.findByUrl(it)