-#[derive(Clone, Debug, Deserialize, Serialize, ActivityFields)]
-#[serde(rename_all = "camelCase")]
-pub struct AcceptFollowCommunity {
- actor: ObjectId<ApubCommunity>,
- to: [ObjectId<ApubPerson>; 1],
- object: FollowCommunity,
- #[serde(rename = "type")]
- kind: AcceptType,
- id: Url,
- #[serde(rename = "@context")]
- context: OneOrMany<AnyBase>,
- #[serde(flatten)]
- unparsed: Unparsed,
-}
-
-impl AcceptFollowCommunity {
- pub async fn send(
- follow: FollowCommunity,
- context: &LemmyContext,
- request_counter: &mut i32,
- ) -> Result<(), LemmyError> {
- let community = follow.object.dereference_local(context).await?;
- let person = follow
- .actor
- .clone()
- .dereference(context, request_counter)
- .await?;
- let accept = AcceptFollowCommunity {
- actor: ObjectId::new(community.actor_id()),
- to: [ObjectId::new(person.actor_id())],
+impl AcceptFollow {
+ #[tracing::instrument(skip_all)]
+ pub async fn send(follow: Follow, context: &Data<LemmyContext>) -> Result<(), LemmyError> {
+ let user_or_community = follow.object.dereference_local(context).await?;
+ let person = follow.actor.clone().dereference(context).await?;
+ let accept = AcceptFollow {
+ actor: user_or_community.id().into(),
+ to: Some([person.id().into()]),