From ed3b3f07fbc0f4b1eb43671e4ca3a7ce9ef170fa Mon Sep 17 00:00:00 2001
From: usbharu <64310155+usbharu@users.noreply.github.com>
Date: Sun, 11 Aug 2024 13:10:10 +0900
Subject: [PATCH] =?UTF-8?q?fix:=20=E8=87=AA=E5=88=86=E8=87=AA=E8=BA=AB?=
=?UTF-8?q?=E3=81=AE=E6=8A=95=E7=A8=BF=E3=81=8C=E8=A6=8B=E3=81=88=E3=81=AA?=
=?UTF-8?q?=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=AA=E3=81=A3=E3=81=A6?=
=?UTF-8?q?=E3=81=84=E3=81=9F=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
hideout-core/src/main/resources/application.yml | 4 +++-
.../src/main/resources/db/migration/V1__Init_DB.sql | 4 ++--
hideout-core/src/main/resources/log4j2.xml | 1 +
hideout-core/src/main/resources/logback.xml | 2 +-
.../status/GetStatusApplicationService.kt | 2 +-
.../exposedquery/ExposedStatusQueryService.kt | 12 ++++++++----
6 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/hideout-core/src/main/resources/application.yml b/hideout-core/src/main/resources/application.yml
index 29c5fb19..95ad5a20 100644
--- a/hideout-core/src/main/resources/application.yml
+++ b/hideout-core/src/main/resources/application.yml
@@ -12,7 +12,9 @@ hideout:
private-key: "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC7VJTUt9Us8cKjMzEfYyjiWA4R4/M2bS1GB4t7NXp98C3SC6dVMvDuictGeurT8jNbvJZHtCSuYEvuNMoSfm76oqFvAp8Gy0iz5sxjZmSnXyCdPEovGhLa0VzMaQ8s+CLOyS56YyCFGeJZqgtzJ6GR3eqoYSW9b9UMvkBpZODSctWSNGj3P7jRFDO5VoTwCQAWbFnOjDfH5Ulgp2PKSQnSJP3AJLQNFNe7br1XbrhV//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YPukrJO4gwE2o5Te6T5mJSZGlQJQj9q4ZB2Dfzet6INsK0oG8XVGXSpQvQh3RUYekCZQkBBFcpqWpbIEsCgYAnM3DQf3FJoSnXaMhrVBIovic5l0xFkEHskAjFTevO86Fsz1C2aSeRKSqGFoOQ0tmJzBEs1R6KqnHInicDTQrKhArgLXX4v3CddjfTRJkFWDbE/CkvKZNOrcf1nhaGCPspRJj2KUkj1Fhl9Cncdn/RsYEONbwQSjIfMPkvxF+8HQ=="
public-key: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1SU1LfVLPHCozMxH2Mo4lgOEePzNm0tRgeLezV6ffAt0gunVTLw7onLRnrq0/IzW7yWR7QkrmBL7jTKEn5u+qKhbwKfBstIs+bMY2Zkp18gnTxKLxoS2tFczGkPLPgizskuemMghRniWaoLcyehkd3qqGElvW/VDL5AaWTg0nLVkjRo9z+40RQzuVaE8AkAFmxZzow3x+VJYKdjykkJ0iT9wCS0DRTXu269V264Vf/3jvredZiKRkgwlL9xNAwxXFg0x/XFw005UWVRIkdgcKWTjpBP2dPwVZ4WWC+9aGVd+Gyn1o0CLelf4rEjGoXbAAEgAqeGUxrcIlbjXfbcmwIDAQAB"
private: true
-
+ debug:
+ trace-query-exception: true
+ trace-query-call: true
diff --git a/hideout-core/src/main/resources/db/migration/V1__Init_DB.sql b/hideout-core/src/main/resources/db/migration/V1__Init_DB.sql
index c42a3f7f..e7330e1b 100644
--- a/hideout-core/src/main/resources/db/migration/V1__Init_DB.sql
+++ b/hideout-core/src/main/resources/db/migration/V1__Init_DB.sql
@@ -188,8 +188,8 @@ create table if not exists relationships
following boolean not null,
blocking boolean not null,
muting boolean not null,
- follow_request boolean not null,
- ignore_follow_request boolean not null,
+ follow_requesting boolean not null,
+ muting_follow_request boolean not null,
constraint fk_relationships_actor_id__id foreign key (actor_id) references actors (id) on delete restrict on update restrict,
constraint fk_relationships_target_actor_id__id foreign key (target_actor_id) references actors (id) on delete restrict on update restrict,
unique (actor_id, target_actor_id)
diff --git a/hideout-core/src/main/resources/log4j2.xml b/hideout-core/src/main/resources/log4j2.xml
index 4a2ec926..3a225230 100644
--- a/hideout-core/src/main/resources/log4j2.xml
+++ b/hideout-core/src/main/resources/log4j2.xml
@@ -12,5 +12,6 @@
+
\ No newline at end of file
diff --git a/hideout-core/src/main/resources/logback.xml b/hideout-core/src/main/resources/logback.xml
index ea1c0ecd..8a8ec24f 100644
--- a/hideout-core/src/main/resources/logback.xml
+++ b/hideout-core/src/main/resources/logback.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/hideout-mastodon/src/main/kotlin/dev/usbharu/hideout/mastodon/application/status/GetStatusApplicationService.kt b/hideout-mastodon/src/main/kotlin/dev/usbharu/hideout/mastodon/application/status/GetStatusApplicationService.kt
index 3121de94..48f71791 100644
--- a/hideout-mastodon/src/main/kotlin/dev/usbharu/hideout/mastodon/application/status/GetStatusApplicationService.kt
+++ b/hideout-mastodon/src/main/kotlin/dev/usbharu/hideout/mastodon/application/status/GetStatusApplicationService.kt
@@ -37,7 +37,7 @@ class GetStatusApplicationService(
}
override suspend fun internalExecute(command: GetStatus, principal: FromApi): Status {
- return statusQueryService.findByPostId(command.id.toLong())
+ return statusQueryService.findByPostId(command.id.toLong(), principal)
?: throw IllegalArgumentException("Post ${command.id} not found.")
}
diff --git a/hideout-mastodon/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/ExposedStatusQueryService.kt b/hideout-mastodon/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/ExposedStatusQueryService.kt
index 4fdc95c1..2e172a33 100644
--- a/hideout-mastodon/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/ExposedStatusQueryService.kt
+++ b/hideout-mastodon/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/ExposedStatusQueryService.kt
@@ -51,14 +51,18 @@ class StatusQueryServiceImpl : StatusQueryService {
return Posts
.leftJoin(PostsVisibleActors)
- .leftJoin(Relationships, otherColumn = { actorId })
- .leftJoin(relationshipsAlias, otherColumn = { relationshipsAlias[Relationships.actorId] })
- .selectAll()
+ .leftJoin(Relationships, onColumn = { Posts.actorId }, otherColumn = { actorId })
+ .leftJoin(
+ relationshipsAlias,
+ onColumn = { Posts.actorId },
+ otherColumn = { relationshipsAlias[Relationships.targetActorId] })
+ .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)))
+ (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")
}