X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fapub%2Fsrc%2Factivities%2Fcommunity%2Flock_page.rs;h=94135ede900cf3579af8641b573cd20ad38d853d;hb=e9e76549a88cfbdab36f00d302cceabcaaa24f4c;hp=5e4eefb8173f7ebf63d24d173cec476bcf882cab;hpb=2423b89ced5c2d110c1284777407682f748a068f;p=lemmy.git diff --git a/crates/apub/src/activities/community/lock_page.rs b/crates/apub/src/activities/community/lock_page.rs index 5e4eefb8..94135ede 100644 --- a/crates/apub/src/activities/community/lock_page.rs +++ b/crates/apub/src/activities/community/lock_page.rs @@ -8,7 +8,7 @@ use crate::{ verify_person_in_community, }, activity_lists::AnnouncableActivities, - insert_activity, + insert_received_activity, protocol::{ activities::community::lock_page::{LockPage, LockType, UndoLockPage}, InCommunity, @@ -60,7 +60,7 @@ impl ActivityHandler for LockPage { async fn receive(self, context: &Data) -> Result<(), Self::Error> { let form = PostUpdateForm::builder().locked(Some(true)).build(); let post = self.object.dereference(context).await?; - Post::update(context.pool(), post.id, &form).await?; + Post::update(&mut context.pool(), post.id, &form).await?; Ok(()) } } @@ -79,6 +79,7 @@ impl ActivityHandler for UndoLockPage { } async fn verify(&self, context: &Data) -> Result<(), Self::Error> { + insert_received_activity(&self.id, context).await?; verify_is_public(&self.to, &self.cc)?; let community = self.community(context).await?; verify_person_in_community(&self.actor, &community, context).await?; @@ -94,10 +95,9 @@ impl ActivityHandler for UndoLockPage { } async fn receive(self, context: &Data) -> Result<(), Self::Error> { - insert_activity(&self.id, &self, false, false, context).await?; let form = PostUpdateForm::builder().locked(Some(false)).build(); let post = self.object.object.dereference(context).await?; - Post::update(context.pool(), post.id, &form).await?; + Post::update(&mut context.pool(), post.id, &form).await?; Ok(()) } } @@ -145,7 +145,7 @@ impl SendActivity for LockPost { }; AnnouncableActivities::UndoLockPost(undo) }; - let community = Community::read(context.pool(), response.post_view.community.id).await?; + let community = Community::read(&mut context.pool(), response.post_view.community.id).await?; send_activity_in_community( activity, &local_user_view.person.into(),