- pub async fn send(
- object: &PostOrComment,
- actor: &Person,
- community_id: CommunityId,
- kind: VoteType,
- context: &LemmyContext,
- ) -> Result<(), LemmyError> {
- let community = blocking(context.pool(), move |conn| {
- Community::read(conn, community_id)
- })
- .await??;
- let id = generate_activity_id(UndoType::Undo)?;
-
- let undo_vote = UndoVote {
- to: PublicUrl::Public,
- object: Vote {
- to: PublicUrl::Public,
- object: object.ap_id(),
- cc: [community.actor_id()],
- kind: kind.clone(),
- common: ActivityCommonFields {
- context: lemmy_context(),
- id: generate_activity_id(kind)?,
- actor: actor.actor_id(),
- unparsed: Default::default(),
- },
- },
- cc: [community.actor_id()],
+ pub(in crate::activities::voting) fn new(
+ vote: Vote,
+ actor: &ApubPerson,
+ community: &ApubCommunity,
+ context: &Data<LemmyContext>,
+ ) -> Result<Self, LemmyError> {
+ Ok(UndoVote {
+ actor: actor.id().into(),
+ object: vote,