1 use crate::activities::{
3 verify_person_in_community,
4 voting::{like::LikePostOrComment, receive_undo_like_or_dislike},
6 use activitystreams::activity::kind::UndoType;
7 use lemmy_apub_lib::{values::PublicUrl, verify_urls_match, ActivityCommonFields, ActivityHandler};
8 use lemmy_utils::LemmyError;
9 use lemmy_websocket::LemmyContext;
12 #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
13 #[serde(rename_all = "camelCase")]
14 pub struct UndoLikePostOrComment {
16 object: LikePostOrComment,
18 #[serde(rename = "type")]
21 common: ActivityCommonFields,
24 #[async_trait::async_trait(?Send)]
25 impl ActivityHandler for UndoLikePostOrComment {
28 context: &LemmyContext,
29 request_counter: &mut i32,
30 ) -> Result<(), LemmyError> {
31 verify_activity(self.common())?;
32 verify_person_in_community(&self.common.actor, &self.cc[0], context, request_counter).await?;
33 verify_urls_match(&self.common.actor, &self.object.common().actor)?;
34 self.object.verify(context, request_counter).await?;
40 context: &LemmyContext,
41 request_counter: &mut i32,
42 ) -> Result<(), LemmyError> {
43 receive_undo_like_or_dislike(
52 fn common(&self) -> &ActivityCommonFields {