From e938f3bb270b7f506db6b36175ad40df0f11d7ab Mon Sep 17 00:00:00 2001 From: alemi Date: Fri, 19 Jul 2024 03:07:08 +0200 Subject: [PATCH] fix: properly check for duplicate dislikes --- upub/core/src/traits/process.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/upub/core/src/traits/process.rs b/upub/core/src/traits/process.rs index 49fb92b..598ee24 100644 --- a/upub/core/src/traits/process.rs +++ b/upub/core/src/traits/process.rs @@ -144,7 +144,7 @@ pub async fn like(ctx: &crate::Context, activity: impl apb::Activity, tx: &Datab pub async fn dislike(ctx: &crate::Context, activity: impl apb::Activity, tx: &DatabaseTransaction) -> Result<(), ProcessorError> { let actor = ctx.fetch_user(activity.actor().id()?, tx).await?; let obj = ctx.fetch_object(activity.object().id()?, tx).await?; - if crate::model::like::Entity::find_by_uid_oid(actor.internal, obj.internal) + if crate::model::dislike::Entity::find_by_uid_oid(actor.internal, obj.internal) .any(tx) .await? { @@ -351,6 +351,7 @@ pub async fn delete(ctx: &crate::Context, activity: impl apb::Activity, tx: &Dat } pub async fn update(ctx: &crate::Context, activity: impl apb::Activity, tx: &DatabaseTransaction) -> Result<(), ProcessorError> { + // TODO when attachments get updated we do nothing!!!!!!!!!! let Some(object_node) = activity.object().extract() else { tracing::error!("refusing to process activity without embedded object"); return Err(ProcessorError::Unprocessable(activity.id()?.to_string()));