1
0
Fork 0
forked from alemi/upub

fix: maybe don't filter whole queries

This commit is contained in:
əlemi 2024-04-30 02:05:28 +02:00
parent a4cdd2e67b
commit 8af2cd2664
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -1,5 +1,5 @@
use apb::{ActivityMut, CollectionMut, ObjectMut};
use sea_orm::{entity::prelude::*, Condition, FromQueryResult, Iterable, Order, QueryOrder, QuerySelect, SelectColumns};
use sea_orm::{entity::prelude::*, sea_query::IntoCondition, Condition, FromQueryResult, Iterable, Order, QueryOrder, QuerySelect, SelectColumns};
use crate::routes::activitypub::jsonld::LD;
@ -169,9 +169,13 @@ impl Entity {
.order_by(Column::Published, Order::Desc);
if let Some(uid) = uid {
let uid = uid.to_string();
select = select
.filter(crate::model::like::Column::Actor.eq(uid))
.join(sea_orm::JoinType::LeftJoin, crate::model::object::Relation::Like.def())
.join(
sea_orm::JoinType::LeftJoin,
crate::model::object::Relation::Like.def()
.on_condition(move |_l, _r| crate::model::like::Column::Actor.eq(uid.clone()).into_condition()),
)
.select_column_as(crate::model::like::Column::Actor, format!("{}{}", crate::model::like::Entity.table_name(), crate::model::like::Column::Actor.to_string()));
}