fix: 自分自身の投稿が見えないようになっていた問題を修正

This commit is contained in:
usbharu 2024-08-11 13:10:10 +09:00
parent 146b907c69
commit ed3b3f07fb
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
6 changed files with 16 additions and 9 deletions

View File

@ -12,7 +12,9 @@ hideout:
private-key: "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC7VJTUt9Us8cKjMzEfYyjiWA4R4/M2bS1GB4t7NXp98C3SC6dVMvDuictGeurT8jNbvJZHtCSuYEvuNMoSfm76oqFvAp8Gy0iz5sxjZmSnXyCdPEovGhLa0VzMaQ8s+CLOyS56YyCFGeJZqgtzJ6GR3eqoYSW9b9UMvkBpZODSctWSNGj3P7jRFDO5VoTwCQAWbFnOjDfH5Ulgp2PKSQnSJP3AJLQNFNe7br1XbrhV//eO+t51mIpGSDCUv3E0DDFcWDTH9cXDTTlRZVEiR2BwpZOOkE/Z0/BVnhZYL71oZV34bKfWjQIt6V/isSMahdsAASACp4ZTGtwiVuNd9tybAgMBAAECggEBAKTmjaS6tkK8BlPXClTQ2vpz/N6uxDeS35mXpqasqskVlaAidgg/sWqpjXDbXr93otIMLlWsM+X0CqMDgSXKejLS2jx4GDjI1ZTXg++0AMJ8sJ74pWzVDOfmCEQ/7wXs3+cbnXhKriO8Z036q92Qc1+N87SI38nkGa0ABH9CN83HmQqt4fB7UdHzuIRe/me2PGhIq5ZBzj6h3BpoPGzEP+x3l9YmK8t/1cN0pqI+dQwYdgfGjackLu/2qH80MCF7IyQaseZUOJyKrCLtSD/Iixv/hzDEUPfOCjFDgTpzf3cwta8+oE4wHCo1iI1/4TlPkwmXx4qSXtmw4aQPz7IDQvECgYEA8KNThCO2gsC2I9PQDM/8Cw0O983WCDY+oi+7JPiNAJwv5DYBqEZB1QYdj06YD16XlC/HAZMsMku1na2TN0driwenQQWzoev3g2S7gRDoS/FCJSI3jJ+kjgtaA7Qmzlgk1TxODN+G1H91HW7t0l7VnL27IWyYo2qR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rEjGoXbAAEgAqeGUxrcIlbjXfbcmwIDAQAB"
private: true
debug:
trace-query-exception: true
trace-query-call: true

View File

@ -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)

View File

@ -12,5 +12,6 @@
<Logger name="dev.usbharu.owl.broker.service.QueuedTaskAssignerImpl" level="TRACE"/>
<Logger name="org.mongodb.driver.cluster" level="WARN"/>
<Logger name="org.apache.tomcat.util.net.NioEndpoint" level="INFO"/>
<Logger name="Exposed" level="DEBUG"/>
</Loggers>
</Configuration>

View File

@ -27,7 +27,7 @@
<logger name="org.eclipse.jetty" level="INFO"/>
<logger name="io.netty" level="INFO"/>
<logger name="kjob.core.internal.scheduler.JobServiceImpl" level="INFO"/>
<logger name="Exposed" level="INFO"/>
<logger name="Exposed" level="DEBUG"/>
<logger name="io.ktor.server.plugins.contentnegotiation" level="INFO"/>
<logger name="org.springframework.web.filter.CommonsRequestLoggingFilter" level="DEBUG"/>
<logger name="org.mongodb.driver.protocol.command" level="INFO"/>

View File

@ -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.")
}

View File

@ -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")
}