fix: internal checks must return at least a column

This commit is contained in:
əlemi 2024-05-27 18:11:34 +02:00
parent 40f12ec636
commit 144f2b2be7
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -181,16 +181,37 @@ impl Context {
} }
pub async fn is_local_internal_object(&self, internal: i64) -> crate::Result<bool> { pub async fn is_local_internal_object(&self, internal: i64) -> crate::Result<bool> {
Ok(model::object::Entity::find_by_id(internal).select_only().one(self.db()).await?.is_some()) Ok(
model::object::Entity::find_by_id(internal)
.select_only()
.select_column(model::object::Column::Internal)
.one(self.db())
.await?
.is_some()
)
} }
pub async fn is_local_internal_activity(&self, internal: i64) -> crate::Result<bool> { pub async fn is_local_internal_activity(&self, internal: i64) -> crate::Result<bool> {
Ok(model::activity::Entity::find_by_id(internal).select_only().one(self.db()).await?.is_some()) Ok(
model::activity::Entity::find_by_id(internal)
.select_only()
.select_column(model::activity::Column::Internal)
.one(self.db())
.await?
.is_some()
)
} }
#[allow(unused)] #[allow(unused)]
pub async fn is_local_internal_actor(&self, internal: i64) -> crate::Result<bool> { pub async fn is_local_internal_actor(&self, internal: i64) -> crate::Result<bool> {
Ok(model::actor::Entity::find_by_id(internal).select_only().one(self.db()).await?.is_some()) Ok(
model::actor::Entity::find_by_id(internal)
.select_only()
.select_column(model::actor::Column::Internal)
.one(self.db())
.await?
.is_some()
)
} }
pub async fn expand_addressing(&self, targets: Vec<String>) -> crate::Result<Vec<String>> { pub async fn expand_addressing(&self, targets: Vec<String>) -> crate::Result<Vec<String>> {