- 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 object = Vote::new(object, actor, &community, kind.clone(), context)?;
- let id = generate_activity_id(
- UndoType::Undo,
- &context.settings().get_protocol_and_hostname(),
- )?;
- let undo_vote = UndoVote {
- actor: ObjectId::new(actor.actor_id()),
- to: [PublicUrl::Public],
- object,
- cc: [ObjectId::new(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,