2 activities::verify_community_matches,
3 objects::{community::ApubCommunity, person::ApubPerson},
4 protocol::{activities::voting::vote::Vote, InCommunity},
6 use activitypub_federation::core::object_id::ObjectId;
7 use activitystreams_kinds::activity::UndoType;
8 use lemmy_api_common::context::LemmyContext;
9 use lemmy_utils::error::LemmyError;
10 use serde::{Deserialize, Serialize};
13 #[derive(Clone, Debug, Deserialize, Serialize)]
14 #[serde(rename_all = "camelCase")]
16 pub(crate) actor: ObjectId<ApubPerson>,
17 pub(crate) object: Vote,
18 #[serde(rename = "type")]
19 pub(crate) kind: UndoType,
21 pub(crate) audience: Option<ObjectId<ApubCommunity>>,
24 #[async_trait::async_trait(?Send)]
25 impl InCommunity for UndoVote {
28 context: &LemmyContext,
29 request_counter: &mut i32,
30 ) -> Result<ApubCommunity, LemmyError> {
31 let community = self.object.community(context, request_counter).await?;
32 if let Some(audience) = &self.audience {
33 verify_community_matches(audience, community.actor_id.clone())?;