Merge remote-tracking branch 'origin/multiproject' into multiproject

This commit is contained in:
usbharu 2024-12-19 20:33:26 +09:00
commit c75f5da307
Signed by: usbharu
GPG Key ID: 95CBCF7046307B77
26 changed files with 163 additions and 163 deletions

View File

@ -46,9 +46,9 @@ class GetLocalInstanceApplicationService(
}
val instance = (
instanceRepository.findByUrl(applicationConfig.url)
?: throw InternalServerException("Local instance not found.")
)
instanceRepository.findByUrl(applicationConfig.url)
?: throw InternalServerException("Local instance not found.")
)
cachedInstance = Instance.of(instance)
@Suppress("UnsafeCallOnNullableType")

View File

@ -47,14 +47,14 @@ class GetRelationshipApplicationService(
val target = actorRepository.findById(targetId)
?: throw IllegalArgumentException("Actor ${command.targetActorId} not found.")
val relationship = (
relationshipRepository.findByActorIdAndTargetId(actor.id, targetId)
?: dev.usbharu.hideout.core.domain.model.relationship.Relationship.default(actor.id, targetId)
)
relationshipRepository.findByActorIdAndTargetId(actor.id, targetId)
?: dev.usbharu.hideout.core.domain.model.relationship.Relationship.default(actor.id, targetId)
)
val relationship1 = (
relationshipRepository.findByActorIdAndTargetId(targetId, actor.id)
?: dev.usbharu.hideout.core.domain.model.relationship.Relationship.default(targetId, actor.id)
)
relationshipRepository.findByActorIdAndTargetId(targetId, actor.id)
?: dev.usbharu.hideout.core.domain.model.relationship.Relationship.default(targetId, actor.id)
)
val actorInstanceRelationship =
actorInstanceRelationshipRepository.findByActorIdAndInstanceId(actor.id, target.instance)

View File

@ -41,9 +41,9 @@ class UserRegisterHomeTimelineApplicationService(
) : AbstractApplicationService<RegisterHomeTimeline, Unit>(transaction, logger) {
override suspend fun internalExecute(command: RegisterHomeTimeline, principal: Principal) {
val userDetail = (
userDetailRepository.findById(UserDetailId(command.userDetailId))
?: throw IllegalArgumentException("UserDetail ${command.userDetailId} not found.")
)
userDetailRepository.findById(UserDetailId(command.userDetailId))
?: throw IllegalArgumentException("UserDetail ${command.userDetailId} not found.")
)
val timeline = Timeline.create(
TimelineId(idGenerateService.generateId()),

View File

@ -39,14 +39,14 @@ class UserRemoveTimelineRelationshipApplicationService(
override suspend fun internalExecute(command: RemoveTimelineRelationship, principal: LocalUser) {
val timelineRelationship = (
timelineRelationshipRepository.findById(command.timelineRelationshipId)
?: throw IllegalArgumentException("TimelineRelationship ${command.timelineRelationshipId} not found.")
)
timelineRelationshipRepository.findById(command.timelineRelationshipId)
?: throw IllegalArgumentException("TimelineRelationship ${command.timelineRelationshipId} not found.")
)
val timeline = (
timelineRepository.findById(timelineRelationship.timelineId)
?: throw IllegalArgumentException("Timeline ${timelineRelationship.timelineId} not found.")
)
timelineRepository.findById(timelineRelationship.timelineId)
?: throw IllegalArgumentException("Timeline ${timelineRelationship.timelineId} not found.")
)
if (timeline.userDetailId != principal.userDetailId) {
throw PermissionDeniedException()

View File

@ -158,34 +158,34 @@ class Actor(
override fun toString(): String {
return "Actor(" +
"id=$id, " +
"name=$name, " +
"domain=$domain, " +
"inbox=$inbox, " +
"outbox=$outbox, " +
"url=$url, " +
"publicKey=$publicKey, " +
"privateKey=$privateKey, " +
"createdAt=$createdAt, " +
"keyId=$keyId, " +
"followersEndpoint=$followersEndpoint, " +
"followingEndpoint=$followingEndpoint, " +
"instance=$instance, " +
"locked=$locked, " +
"followersCount=$followersCount, " +
"followingCount=$followingCount, " +
"postsCount=$postsCount, " +
"lastPostAt=$lastPostAt, " +
"lastUpdateAt=$lastUpdateAt, " +
"banner=$banner, " +
"icon=$icon, " +
"suspend=$suspend, " +
"alsoKnownAs=$alsoKnownAs, " +
"moveTo=$moveTo, " +
"emojis=$emojis, " +
"description=$description, " +
"screenName=$screenName, " +
"deleted=$deleted" +
")"
"id=$id, " +
"name=$name, " +
"domain=$domain, " +
"inbox=$inbox, " +
"outbox=$outbox, " +
"url=$url, " +
"publicKey=$publicKey, " +
"privateKey=$privateKey, " +
"createdAt=$createdAt, " +
"keyId=$keyId, " +
"followersEndpoint=$followersEndpoint, " +
"followingEndpoint=$followingEndpoint, " +
"instance=$instance, " +
"locked=$locked, " +
"followersCount=$followersCount, " +
"followingCount=$followingCount, " +
"postsCount=$postsCount, " +
"lastPostAt=$lastPostAt, " +
"lastUpdateAt=$lastUpdateAt, " +
"banner=$banner, " +
"icon=$icon, " +
"suspend=$suspend, " +
"alsoKnownAs=$alsoKnownAs, " +
"moveTo=$moveTo, " +
"emojis=$emojis, " +
"description=$description, " +
"screenName=$screenName, " +
"deleted=$deleted" +
")"
}
}

View File

@ -25,12 +25,12 @@ value class ActorPrivateKey(val privateKey: String) {
fun create(privateKey: PrivateKey): ActorPrivateKey {
return ActorPrivateKey(
"-----BEGIN PRIVATE KEY-----\n" +
Base64
.getEncoder()
.encodeToString(privateKey.encoded)
.chunked(64)
.joinToString("\n") +
"\n-----END PRIVATE KEY-----"
Base64
.getEncoder()
.encodeToString(privateKey.encoded)
.chunked(64)
.joinToString("\n") +
"\n-----END PRIVATE KEY-----"
)
}
}

View File

@ -25,12 +25,12 @@ value class ActorPublicKey(val publicKey: String) {
fun create(publicKey: PublicKey): ActorPublicKey {
return ActorPublicKey(
"-----BEGIN PUBLIC KEY-----\n" +
Base64
.getEncoder()
.encodeToString(publicKey.encoded)
.chunked(64)
.joinToString("\n") +
"\n-----END PUBLIC KEY-----"
Base64
.getEncoder()
.encodeToString(publicKey.encoded)
.chunked(64)
.joinToString("\n") +
"\n-----END PUBLIC KEY-----"
)
}
}

View File

@ -89,12 +89,12 @@ class ActorInstanceRelationship(
override fun toString(): String {
return "ActorInstanceRelationship(" +
"actorId=$actorId, " +
"instanceId=$instanceId, " +
"blocking=$blocking, " +
"muting=$muting, " +
"doNotSendPrivate=$doNotSendPrivate" +
")"
"actorId=$actorId, " +
"instanceId=$instanceId, " +
"blocking=$blocking, " +
"muting=$muting, " +
"doNotSendPrivate=$doNotSendPrivate" +
")"
}
companion object {

View File

@ -29,9 +29,9 @@ sealed class Emoji {
abstract fun id(): String
override fun toString(): String {
return "Emoji(" +
"domain='$domain', " +
"name='$name'" +
")"
"domain='$domain', " +
"name='$name'" +
")"
}
}

View File

@ -84,13 +84,13 @@ class Filter(
override fun hashCode(): Int = id.hashCode()
override fun toString(): String {
return "Filter(" +
"id=$id, " +
"userDetailId=$userDetailId, " +
"name=$name, " +
"filterContext=$filterContext, " +
"filterAction=$filterAction, " +
"filterKeywords=$filterKeywords" +
")"
"id=$id, " +
"userDetailId=$userDetailId, " +
"name=$name, " +
"filterContext=$filterContext, " +
"filterAction=$filterAction, " +
"filterKeywords=$filterKeywords" +
")"
}
companion object {

View File

@ -34,9 +34,9 @@ class FilterKeyword(
override fun toString(): String {
return "FilterKeyword(" +
"id=$id, " +
"keyword=$keyword, " +
"mode=$mode" +
")"
"id=$id, " +
"keyword=$keyword, " +
"mode=$mode" +
")"
}
}

View File

@ -33,8 +33,8 @@ class FilterName(name: String) {
override fun toString(): String {
return "FilterName(" +
"name='$name'" +
")"
"name='$name'" +
")"
}
companion object {

View File

@ -37,8 +37,8 @@ class FilterResult(val filter: Filter, val matchedKeyword: String) {
override fun toString(): String {
return "FilterResult(" +
"filter=$filter, " +
"matchedKeyword='$matchedKeyword'" +
")"
"filter=$filter, " +
"matchedKeyword='$matchedKeyword'" +
")"
}
}

View File

@ -39,8 +39,8 @@ class FilteredPost(val post: Post, val filterResults: List<FilterResult>) {
override fun toString(): String {
return "FilteredPost(" +
"post=$post, " +
"filterResults=$filterResults" +
")"
"post=$post, " +
"filterResults=$filterResults" +
")"
}
}

View File

@ -52,16 +52,16 @@ class Media(
override fun toString(): String {
return "Media(" +
"id=$id, " +
"name=$name, " +
"remoteUrl=$remoteUrl, " +
"thumbnailUrl=$thumbnailUrl, " +
"type=$type, " +
"mimeType=$mimeType, " +
"blurHash=$blurHash, " +
"description=$description, " +
"actorId=$actorId, " +
"url=$url" +
")"
"id=$id, " +
"name=$name, " +
"remoteUrl=$remoteUrl, " +
"thumbnailUrl=$thumbnailUrl, " +
"type=$type, " +
"mimeType=$mimeType, " +
"blurHash=$blurHash, " +
"description=$description, " +
"actorId=$actorId, " +
"url=$url" +
")"
}
}

View File

@ -241,25 +241,25 @@ class Post(
override fun toString(): String {
return "Post(" +
"id=$id, " +
"createdAt=$createdAt, " +
"url=$url, " +
"repostId=$repostId, " +
"replyId=$replyId, " +
"apId=$apId, " +
"actorId=$actorId, " +
"visibility=$visibility, " +
"visibleActors=$visibleActors, " +
"content=$content, " +
"overview=$overview, " +
"sensitive=$sensitive, " +
"text='$text', " +
"emojiIds=$emojiIds, " +
"mediaIds=$mediaIds, " +
"deleted=$deleted, " +
"hide=$hide, " +
"moveTo=$moveTo" +
")"
"id=$id, " +
"createdAt=$createdAt, " +
"url=$url, " +
"repostId=$repostId, " +
"replyId=$replyId, " +
"apId=$apId, " +
"actorId=$actorId, " +
"visibility=$visibility, " +
"visibleActors=$visibleActors, " +
"content=$content, " +
"overview=$overview, " +
"sensitive=$sensitive, " +
"text='$text', " +
"emojiIds=$emojiIds, " +
"mediaIds=$mediaIds, " +
"deleted=$deleted, " +
"hide=$hide, " +
"moveTo=$moveTo" +
")"
}
companion object {

View File

@ -77,9 +77,9 @@ class TimelineObject(
lastUpdatedAt = Instant.now()
isPureRepost =
post.repostId != null &&
post.replyId == null &&
post.text.isEmpty() &&
post.overview?.overview.isNullOrEmpty()
post.replyId == null &&
post.text.isEmpty() &&
post.overview?.overview.isNullOrEmpty()
warnFilters = filterResults.map { TimelineObjectWarnFilter(it.filter.id, it.matchedKeyword) }
}
@ -149,9 +149,9 @@ class TimelineObject(
repostActorId = repost.actorId,
visibility = post.visibility,
isPureRepost = repost.mediaIds.isEmpty() &&
repost.overview == null &&
repost.content == PostContent.empty &&
repost.replyId == null,
repost.overview == null &&
repost.content == PostContent.empty &&
repost.replyId == null,
mediaIds = post.mediaIds,
emojiIds = post.emojiIds,
visibleActors = post.visibleActors.toList(),

View File

@ -44,13 +44,13 @@ class UserDetail(
override fun hashCode(): Int = id.hashCode()
override fun toString(): String {
return "UserDetail(" +
"id=$id, " +
"actorId=$actorId, " +
"password=$password, " +
"autoAcceptFolloweeFollowRequest=$autoAcceptFolloweeFollowRequest, " +
"lastMigration=$lastMigration, " +
"homeTimelineId=$homeTimelineId" +
")"
"id=$id, " +
"actorId=$actorId, " +
"password=$password, " +
"autoAcceptFolloweeFollowRequest=$autoAcceptFolloweeFollowRequest, " +
"lastMigration=$lastMigration, " +
"homeTimelineId=$homeTimelineId" +
")"
}
companion object {

View File

@ -39,9 +39,9 @@ class DefaultPostReadAccessControl(private val relationshipRepository: Relations
}
val relationship = (
relationshipRepository.findByActorIdAndTargetId(post.actorId, principal.actorId)
?: Relationship.default(post.actorId, principal.actorId)
)
relationshipRepository.findByActorIdAndTargetId(post.actorId, principal.actorId)
?: Relationship.default(post.actorId, principal.actorId)
)
// ブロックされてたら見れない
if (relationship.blocking) {

View File

@ -53,16 +53,16 @@ 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")
}

View File

@ -54,7 +54,7 @@ class ExposedActorInstanceRelationshipRepository(override val domainEventPublish
query {
ActorInstanceRelationships.deleteWhere {
actorId eq actorInstanceRelationship.actorId.id and
(instanceId eq actorInstanceRelationship.instanceId.instanceId)
(instanceId eq actorInstanceRelationship.instanceId.instanceId)
}
onComplete {
update(actorInstanceRelationship)
@ -70,7 +70,7 @@ class ExposedActorInstanceRelationshipRepository(override val domainEventPublish
.selectAll()
.where {
ActorInstanceRelationships.actorId eq actorId.id and
(ActorInstanceRelationships.instanceId eq instanceId.instanceId)
(ActorInstanceRelationships.instanceId eq instanceId.instanceId)
}
.limit(1)
.singleOrNull()

View File

@ -87,10 +87,10 @@ class ExposedRelationshipRepository(override val domainEventPublisher: DomainEve
): List<Relationship> = query {
Relationships.selectAll().where {
Relationships.actorId eq actorId.id and (
Relationships.targetActorId inList targetIds.map {
it.id
}
) and (Relationships.following eq following)
Relationships.targetActorId inList targetIds.map {
it.id
}
) and (Relationships.following eq following)
}.map { it.toRelationships() }
}

View File

@ -70,11 +70,11 @@ class HideoutUserDetails(
override fun toString(): String {
return "HideoutUserDetails(" +
"password='$password', " +
"username='$username', " +
"userDetailsId=$userDetailsId, " +
"authorities=$authorities" +
")"
"password='$password', " +
"username='$username', " +
"userDetailsId=$userDetailsId, " +
"authorities=$authorities" +
")"
}
companion object {

View File

@ -262,8 +262,8 @@ abstract class AbstractTimelineStore(private val idGenerateService: IdGenerateSe
val actors =
getActors(
timelineObjectList.map { it.postActorId } +
timelineObjectList.mapNotNull { it.repostActorId } +
timelineObjectList.mapNotNull { it.replyActorId }
timelineObjectList.mapNotNull { it.repostActorId } +
timelineObjectList.mapNotNull { it.replyActorId }
)
val postMap = posts.associate { post ->
@ -272,7 +272,7 @@ abstract class AbstractTimelineStore(private val idGenerateService: IdGenerateSe
val mediaMap = getMedias(
posts.flatMap { it.mediaIds } +
actors.mapNotNull { it.value.icon }
actors.mapNotNull { it.value.icon }
)
val reactions = getReactions(posts.map { it.id })

View File

@ -59,10 +59,10 @@ class StatusQueryServiceImpl : StatusQueryService {
.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")
}

View File

@ -66,8 +66,8 @@ class StatusesRequest {
override fun toString(): String {
return "StatusesRequest(status=$status, mediaIds=$media_ids, poll=$poll, inReplyToId=$in_reply_to_id, " +
"sensitive=$sensitive, spoilerText=$spoiler_text, visibility=$visibility, language=$language," +
" scheduledAt=$scheduled_at)"
"sensitive=$sensitive, spoilerText=$spoiler_text, visibility=$visibility, language=$language," +
" scheduledAt=$scheduled_at)"
}
@Suppress("EnumNaming", "EnumEntryNameCase")