fix: relation checks with accept != null
This commit is contained in:
parent
31d536d3d5
commit
784be32cfb
1 changed files with 3 additions and 0 deletions
|
@ -73,6 +73,7 @@ impl Entity {
|
||||||
.to(super::actor::Column::Internal)
|
.to(super::actor::Column::Internal)
|
||||||
.into()
|
.into()
|
||||||
)
|
)
|
||||||
|
.filter(Column::Accept.is_not_null())
|
||||||
.filter(Column::Following.eq(internal_id))
|
.filter(Column::Following.eq(internal_id))
|
||||||
.select_only()
|
.select_only()
|
||||||
.select_column(super::actor::Column::Id)
|
.select_column(super::actor::Column::Id)
|
||||||
|
@ -94,6 +95,7 @@ impl Entity {
|
||||||
.to(super::actor::Column::Internal)
|
.to(super::actor::Column::Internal)
|
||||||
.into()
|
.into()
|
||||||
)
|
)
|
||||||
|
.filter(Column::Accept.is_not_null())
|
||||||
.filter(Column::Follower.eq(internal_id))
|
.filter(Column::Follower.eq(internal_id))
|
||||||
.select_only()
|
.select_only()
|
||||||
.select_column(super::actor::Column::Id)
|
.select_column(super::actor::Column::Id)
|
||||||
|
@ -107,6 +109,7 @@ impl Entity {
|
||||||
// TODO this is 3 queries!!! can it be optimized down to 1?
|
// TODO this is 3 queries!!! can it be optimized down to 1?
|
||||||
pub fn is_following(follower: i64, following: i64) -> sea_orm::Selector<sea_orm::SelectGetableTuple<i64>> {
|
pub fn is_following(follower: i64, following: i64) -> sea_orm::Selector<sea_orm::SelectGetableTuple<i64>> {
|
||||||
Entity::find()
|
Entity::find()
|
||||||
|
.filter(Column::Accept.is_not_null())
|
||||||
.filter(Column::Follower.eq(follower))
|
.filter(Column::Follower.eq(follower))
|
||||||
.filter(Column::Following.eq(following))
|
.filter(Column::Following.eq(following))
|
||||||
.select_only()
|
.select_only()
|
||||||
|
|
Loading…
Reference in a new issue