{
"actor": "http://enterprise.lemmy.ml/c/main",
- "to": [
- "http://ds9.lemmy.ml/u/lemmy_alpha"
- ],
"object": {
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
- "to": [
- "http://enterprise.lemmy.ml/c/main"
- ],
"object": "http://enterprise.lemmy.ml/c/main",
"type": "Follow",
"id": "http://ds9.lemmy.ml/activities/follow/6abcd50b-b8ca-4952-86b0-a6dd8cc12866"
{
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
- "to": [
- "http://enterprise.lemmy.ml/c/main"
- ],
"object": "http://enterprise.lemmy.ml/c/main",
"type": "Follow",
"id": "http://ds9.lemmy.ml/activities/follow/6abcd50b-b8ca-4952-86b0-a6dd8cc12866"
{
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
- "to": [
- "http://enterprise.lemmy.ml/c/main"
- ],
"object": {
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
- "to": [
- "http://enterprise.lemmy.ml/c/main"
- ],
"object": "http://enterprise.lemmy.ml/c/main",
"type": "Follow",
"id": "http://ds9.lemmy.ml/activities/follow/dc2f1bc5-f3a0-4daa-a46b-428cbfbd023c"
.await?;
let accept = AcceptFollowCommunity {
actor: ObjectId::new(community.actor_id()),
- to: [ObjectId::new(person.actor_id())],
object: follow,
kind: AcceptType::Accept,
id: generate_activity_id(
request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_activity(&self.id, self.actor.inner(), &context.settings())?;
- verify_urls_match(self.to[0].inner(), self.object.actor.inner())?;
- verify_urls_match(self.actor.inner(), self.object.to[0].inner())?;
+ verify_urls_match(self.actor.inner(), self.object.object.inner())?;
self.object.verify(context, request_counter).await?;
Ok(())
}
context: &Data<LemmyContext>,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
- let actor = self.actor.dereference(context, request_counter).await?;
- let to = self.to[0].dereference(context, request_counter).await?;
+ let person = self.actor.dereference(context, request_counter).await?;
+ let community = self
+ .object
+ .actor
+ .dereference(context, request_counter)
+ .await?;
// This will throw an error if no follow was requested
blocking(context.pool(), move |conn| {
- CommunityFollower::follow_accepted(conn, actor.id, to.id)
+ CommunityFollower::follow_accepted(conn, person.id, community.id)
})
.await??;
data::Data,
object_id::ObjectId,
traits::{ActivityHandler, ActorType},
- verify::verify_urls_match,
};
use lemmy_db_schema::{
source::community::{CommunityFollower, CommunityFollowerForm},
) -> Result<FollowCommunity, LemmyError> {
Ok(FollowCommunity {
actor: ObjectId::new(actor.actor_id()),
- to: [ObjectId::new(community.actor_id())],
object: ObjectId::new(community.actor_id()),
kind: FollowType::Follow,
id: generate_activity_id(
request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_activity(&self.id, self.actor.inner(), &context.settings())?;
- verify_urls_match(self.to[0].inner(), self.object.inner())?;
verify_person(&self.actor, context, request_counter).await?;
- let community = self.to[0].dereference(context, request_counter).await?;
+ let community = self.object.dereference(context, request_counter).await?;
verify_person_in_community(&self.actor, &community, context, request_counter).await?;
Ok(())
}
context: &Data<LemmyContext>,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
- let actor = self.actor.dereference(context, request_counter).await?;
- let community = self.to[0].dereference(context, request_counter).await?;
+ let person = self.actor.dereference(context, request_counter).await?;
+ let community = self.object.dereference(context, request_counter).await?;
let community_follower_form = CommunityFollowerForm {
community_id: community.id,
- person_id: actor.id,
+ person_id: person.id,
pending: false,
};
let object = FollowCommunity::new(actor, community, context)?;
let undo = UndoFollowCommunity {
actor: ObjectId::new(actor.actor_id()),
- to: [ObjectId::new(community.actor_id())],
object,
kind: UndoType::Undo,
id: generate_activity_id(
request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_activity(&self.id, self.actor.inner(), &context.settings())?;
- verify_urls_match(self.to[0].inner(), self.object.object.inner())?;
verify_urls_match(self.actor.inner(), self.object.actor.inner())?;
verify_person(&self.actor, context, request_counter).await?;
self.object.verify(context, request_counter).await?;
context: &Data<LemmyContext>,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
- let actor = self.actor.dereference(context, request_counter).await?;
- let community = self.to[0].dereference(context, request_counter).await?;
+ let person = self.actor.dereference(context, request_counter).await?;
+ let community = self
+ .object
+ .object
+ .dereference(context, request_counter)
+ .await?;
let community_follower_form = CommunityFollowerForm {
community_id: community.id,
- person_id: actor.id,
+ person_id: person.id,
pending: false,
};
use crate::{
- objects::{community::ApubCommunity, person::ApubPerson},
+ objects::community::ApubCommunity,
protocol::activities::following::follow::FollowCommunity,
};
use activitystreams::{activity::kind::AcceptType, unparsed::Unparsed};
#[serde(rename_all = "camelCase")]
pub struct AcceptFollowCommunity {
pub(crate) actor: ObjectId<ApubCommunity>,
- pub(crate) to: [ObjectId<ApubPerson>; 1],
pub(crate) object: FollowCommunity,
#[serde(rename = "type")]
pub(crate) kind: AcceptType,
#[serde(rename_all = "camelCase")]
pub struct FollowCommunity {
pub(crate) actor: ObjectId<ApubPerson>,
- pub(crate) to: [ObjectId<ApubCommunity>; 1],
pub(crate) object: ObjectId<ApubCommunity>,
#[serde(rename = "type")]
pub(crate) kind: FollowType,
use crate::{
- objects::{community::ApubCommunity, person::ApubPerson},
+ objects::person::ApubPerson,
protocol::activities::following::follow::FollowCommunity,
};
use activitystreams::{activity::kind::UndoType, unparsed::Unparsed};
#[serde(rename_all = "camelCase")]
pub struct UndoFollowCommunity {
pub(crate) actor: ObjectId<ApubPerson>,
- pub(crate) to: [ObjectId<ApubCommunity>; 1],
pub(crate) object: FollowCommunity,
#[serde(rename = "type")]
pub(crate) kind: UndoType,