Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutomic committed Apr 24, 2023
1 parent 5a0621b commit 2b74917
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions crates/apub/assets/lemmy/activities/following/accept.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"actor": "http://enterprise.lemmy.ml/c/main",
"to": "http://ds9.lemmy.ml/u/lemmy_alpha",
"to": ["http://ds9.lemmy.ml/u/lemmy_alpha"],
"object": {
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
"to": "http://enterprise.lemmy.ml/c/main",
"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"
Expand Down
2 changes: 1 addition & 1 deletion crates/apub/assets/lemmy/activities/following/follow.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
"to": "http://enterprise.lemmy.ml/c/main",
"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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
"to": "http://enterprise.lemmy.ml/c/main",
"to": ["http://enterprise.lemmy.ml/c/main"],
"object": {
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
"to": "http://enterprise.lemmy.ml/c/main",
"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"
Expand Down
4 changes: 2 additions & 2 deletions crates/apub/src/activities/following/accept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl AcceptFollow {
let person = follow.actor.clone().dereference(context).await?;
let accept = AcceptFollow {
actor: user_or_community.id().into(),
to: Some(person.id().into()),
to: Some([person.id().into()]),
object: follow,
kind: AcceptType::Accept,
id: generate_activity_id(
Expand Down Expand Up @@ -66,7 +66,7 @@ impl ActivityHandler for AcceptFollow {
verify_urls_match(self.actor.inner(), self.object.object.inner())?;
self.object.verify(context).await?;
if let Some(to) = &self.to {
verify_urls_match(to.inner(), self.object.actor.inner())?;
verify_urls_match(to[0].inner(), self.object.actor.inner())?;
}
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions crates/apub/src/activities/following/follow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Follow {
Ok(Follow {
actor: actor.id().into(),
object: community.id().into(),
to: Some(community.id().into()),
to: Some([community.id().into()]),
kind: FollowType::Follow,
id: generate_activity_id(
FollowType::Follow,
Expand Down Expand Up @@ -96,7 +96,7 @@ impl ActivityHandler for Follow {
verify_person_in_community(&self.actor, &c, context).await?;
}
if let Some(to) = &self.to {
verify_urls_match(to.inner(), self.object.inner())?;
verify_urls_match(to[0].inner(), self.object.inner())?;
}
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions crates/apub/src/activities/following/undo_follow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl UndoFollow {
let object = Follow::new(actor, community, context)?;
let undo = UndoFollow {
actor: actor.id().into(),
to: Some(community.id().into()),
to: Some([community.id().into()]),
object,
kind: UndoType::Undo,
id: generate_activity_id(
Expand Down Expand Up @@ -64,7 +64,7 @@ impl ActivityHandler for UndoFollow {
verify_person(&self.actor, context).await?;
self.object.verify(context).await?;
if let Some(to) = &self.to {
verify_urls_match(to.inner(), self.object.object.inner())?;
verify_urls_match(to[0].inner(), self.object.object.inner())?;
}
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/apub/src/protocol/activities/following/accept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use url::Url;
pub struct AcceptFollow {
pub(crate) actor: ObjectId<ApubCommunity>,
/// Optional, for compatibility with platforms that always expect recipient field
pub(crate) to: Option<ObjectId<ApubPerson>>,
pub(crate) to: Option<[ObjectId<ApubPerson>; 1]>,
pub(crate) object: Follow,
#[serde(rename = "type")]
pub(crate) kind: AcceptType,
Expand Down
2 changes: 1 addition & 1 deletion crates/apub/src/protocol/activities/following/follow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use url::Url;
pub struct Follow {
pub(crate) actor: ObjectId<ApubPerson>,
/// Optional, for compatibility with platforms that always expect recipient field
pub(crate) to: Option<ObjectId<UserOrCommunity>>,
pub(crate) to: Option<[ObjectId<UserOrCommunity>; 1]>,
pub(crate) object: ObjectId<UserOrCommunity>,
#[serde(rename = "type")]
pub(crate) kind: FollowType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use url::Url;
pub struct UndoFollow {
pub(crate) actor: ObjectId<ApubPerson>,
/// Optional, for compatibility with platforms that always expect recipient field
pub(crate) to: Option<ObjectId<ApubPerson>>,
pub(crate) to: Option<[ObjectId<ApubPerson>; 1]>,
pub(crate) object: Follow,
#[serde(rename = "type")]
pub(crate) kind: UndoType,
Expand Down

0 comments on commit 2b74917

Please sign in to comment.