diff --git a/plume-models/src/follows.rs b/plume-models/src/follows.rs index df47b708..0aeaba90 100644 --- a/plume-models/src/follows.rs +++ b/plume-models/src/follows.rs @@ -12,7 +12,7 @@ use activitystreams::{ use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl}; use plume_common::activity_pub::{ broadcast, broadcast07, - inbox::{AsActor, AsObject, FromId}, + inbox::{AsActor, AsObject, AsObject07, FromId}, sign::Signer, Id, IntoId, PUBLIC_VISIBILITY, }; @@ -258,6 +258,18 @@ impl AsObject for User { } } +impl AsObject07 for User { + type Error = Error; + type Output = Follow; + + fn activity07(self, conn: &DbConn, actor: User, id: &str) -> Result { + // Mastodon (at least) requires the full Follow object when accepting it, + // so we rebuilt it here + let follow = FollowAct07::new(id.parse::()?, actor.ap_url.parse::()?); + Follow::accept_follow07(conn, &actor, &self, follow, actor.id, self.id) + } +} + impl FromId for Follow { type Error = Error; type Object = FollowAct;