From 784be32cfb9bfb83a5394af6aacc1aef542d43d8 Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 30 May 2024 02:10:44 +0200 Subject: [PATCH] fix: relation checks with accept != null --- src/model/relation.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/model/relation.rs b/src/model/relation.rs index 1c4deab..724e398 100644 --- a/src/model/relation.rs +++ b/src/model/relation.rs @@ -73,6 +73,7 @@ impl Entity { .to(super::actor::Column::Internal) .into() ) + .filter(Column::Accept.is_not_null()) .filter(Column::Following.eq(internal_id)) .select_only() .select_column(super::actor::Column::Id) @@ -94,6 +95,7 @@ impl Entity { .to(super::actor::Column::Internal) .into() ) + .filter(Column::Accept.is_not_null()) .filter(Column::Follower.eq(internal_id)) .select_only() .select_column(super::actor::Column::Id) @@ -107,6 +109,7 @@ impl Entity { // TODO this is 3 queries!!! can it be optimized down to 1? pub fn is_following(follower: i64, following: i64) -> sea_orm::Selector> { Entity::find() + .filter(Column::Accept.is_not_null()) .filter(Column::Follower.eq(follower)) .filter(Column::Following.eq(following)) .select_only()