use crate::{
activities::{
- community::{announce::GetCommunity, send_activity_in_community},
+ community::send_activity_in_community,
generate_activity_id,
verify_person_in_community,
voting::{undo_vote_comment, undo_vote_post},
activity_lists::AnnouncableActivities,
local_instance,
objects::{community::ApubCommunity, person::ApubPerson},
- protocol::activities::voting::{
- undo_vote::UndoVote,
- vote::{Vote, VoteType},
+ protocol::{
+ activities::voting::{
+ undo_vote::UndoVote,
+ vote::{Vote, VoteType},
+ },
+ InCommunity,
},
ActorType,
PostOrComment,
) -> Result<(), LemmyError> {
let community: ApubCommunity = Community::read(context.pool(), community_id).await?.into();
- let object = Vote::new(object, actor, kind.clone(), context)?;
+ let object = Vote::new(object, actor, &community, kind.clone(), context)?;
let id = generate_activity_id(
UndoType::Undo,
&context.settings().get_protocol_and_hostname(),
object,
kind: UndoType::Undo,
id: id.clone(),
+ audience: Some(ObjectId::new(community.actor_id())),
};
let activity = AnnouncableActivities::UndoVote(undo_vote);
send_activity_in_community(activity, actor, &community, vec![], false, context).await
context: &Data<LemmyContext>,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
- let community = self.get_community(context, request_counter).await?;
+ let community = self.community(context, request_counter).await?;
verify_person_in_community(&self.actor, &community, context, request_counter).await?;
verify_urls_match(self.actor.inner(), self.object.actor.inner())?;
self.object.verify(context, request_counter).await?;
}
}
}
-
-#[async_trait::async_trait(?Send)]
-impl GetCommunity for UndoVote {
- #[tracing::instrument(skip_all)]
- async fn get_community(
- &self,
- context: &LemmyContext,
- request_counter: &mut i32,
- ) -> Result<ApubCommunity, LemmyError> {
- self.object.get_community(context, request_counter).await
- }
-}