1 use crate::activities::{
3 verify_person_in_community,
4 voting::receive_like_or_dislike,
6 use activitystreams::activity::kind::LikeType;
7 use lemmy_apub_lib::{values::PublicUrl, 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 LikePostOrComment {
16 pub(in crate::activities::voting) object: Url,
18 #[serde(rename = "type")]
21 common: ActivityCommonFields,
24 #[async_trait::async_trait(?Send)]
25 impl ActivityHandler for LikePostOrComment {
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?;
38 context: &LemmyContext,
39 request_counter: &mut i32,
40 ) -> Result<(), LemmyError> {
41 receive_like_or_dislike(
51 fn common(&self) -> &ActivityCommonFields {