]> Untitled Git - lemmy.git/commitdiff
Change public activities to field to array (#1739)
authorNutomic <me@nutomic.com>
Sat, 28 Aug 2021 01:33:38 +0000 (01:33 +0000)
committerGitHub <noreply@github.com>
Sat, 28 Aug 2021 01:33:38 +0000 (21:33 -0400)
13 files changed:
crates/apub/src/activities/comment/create_or_update.rs
crates/apub/src/activities/community/add_mod.rs
crates/apub/src/activities/community/announce.rs
crates/apub/src/activities/community/block_user.rs
crates/apub/src/activities/community/remove_mod.rs
crates/apub/src/activities/community/undo_block_user.rs
crates/apub/src/activities/community/update.rs
crates/apub/src/activities/deletion/delete.rs
crates/apub/src/activities/deletion/undo_delete.rs
crates/apub/src/activities/post/create_or_update.rs
crates/apub/src/activities/undo_remove.rs
crates/apub/src/activities/voting/undo_vote.rs
crates/apub/src/activities/voting/vote.rs

index 7f83d78faae01b9cf20ba0241331d304c32d016a..e6876e774741078d90f5d1dd916a47760653d67e 100644 (file)
@@ -27,7 +27,7 @@ use url::Url;
 #[serde(rename_all = "camelCase")]
 pub struct CreateOrUpdateComment {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   object: Note,
   cc: Vec<Url>,
   tag: Vec<Mention>,
@@ -61,7 +61,7 @@ impl CreateOrUpdateComment {
 
     let create_or_update = CreateOrUpdateComment {
       actor: actor.actor_id(),
-      to: PublicUrl::Public,
+      to: [PublicUrl::Public],
       object: comment.to_apub(context.pool()).await?,
       cc: maa.ccs,
       tag: maa.tags,
index f83f14630d3f34fcc57f8d8db651ac4b357e796c..56013d4ae08262e5efd16b84fc6b2af28cb6adaf 100644 (file)
@@ -35,7 +35,7 @@ use url::Url;
 #[serde(rename_all = "camelCase")]
 pub struct AddMod {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   object: Url,
   target: Url,
   cc: [Url; 1],
@@ -58,7 +58,7 @@ impl AddMod {
     let id = generate_activity_id(AddType::Add)?;
     let add = AddMod {
       actor: actor.actor_id(),
-      to: PublicUrl::Public,
+      to: [PublicUrl::Public],
       object: added_mod.actor_id(),
       target: generate_moderators_url(&community.actor_id)?.into(),
       cc: [community.actor_id()],
index e7d917b72d9524827088e9a761f48b7ab42aeba8..d16345ccd80f96ed324448cccce4f0050c31c2a9 100644 (file)
@@ -58,7 +58,7 @@ pub enum AnnouncableActivities {
 #[serde(rename_all = "camelCase")]
 pub struct AnnounceActivity {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   object: AnnouncableActivities,
   cc: Vec<Url>,
   #[serde(rename = "type")]
@@ -79,7 +79,7 @@ impl AnnounceActivity {
   ) -> Result<(), LemmyError> {
     let announce = AnnounceActivity {
       actor: community.actor_id(),
-      to: PublicUrl::Public,
+      to: [PublicUrl::Public],
       object,
       cc: vec![community.followers_url()],
       kind: AnnounceType::Announce,
index d31077dfa28e5e6216b42304acd984ddbdfa9a1f..777faf9a91cc83f2c7cd365ff64eb38921e03418 100644 (file)
@@ -39,7 +39,7 @@ use url::Url;
 #[serde(rename_all = "camelCase")]
 pub struct BlockUserFromCommunity {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   pub(in crate::activities::community) object: Url,
   cc: [Url; 1],
   #[serde(rename = "type")]
@@ -59,7 +59,7 @@ impl BlockUserFromCommunity {
   ) -> Result<BlockUserFromCommunity, LemmyError> {
     Ok(BlockUserFromCommunity {
       actor: actor.actor_id(),
-      to: PublicUrl::Public,
+      to: [PublicUrl::Public],
       object: target.actor_id(),
       cc: [community.actor_id()],
       kind: BlockType::Block,
index 2d4eba56a93b4eb83748ae8c38da190b6be1b8d6..c7175567825a2e29812c2a16cca46a38579655d4 100644 (file)
@@ -36,7 +36,7 @@ use url::Url;
 #[serde(rename_all = "camelCase")]
 pub struct RemoveMod {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   pub(in crate::activities) object: Url,
   cc: [Url; 1],
   #[serde(rename = "type")]
@@ -60,7 +60,7 @@ impl RemoveMod {
     let id = generate_activity_id(RemoveType::Remove)?;
     let remove = RemoveMod {
       actor: actor.actor_id(),
-      to: PublicUrl::Public,
+      to: [PublicUrl::Public],
       object: removed_mod.actor_id(),
       target: Some(generate_moderators_url(&community.actor_id)?.into()),
       id: id.clone(),
index 0a9665af5e0e0805a2529509d46f28a0fad4f575..9c12dd3ae3973d3089363db19999dad54235df06 100644 (file)
@@ -33,7 +33,7 @@ use url::Url;
 #[serde(rename_all = "camelCase")]
 pub struct UndoBlockUserFromCommunity {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   object: BlockUserFromCommunity,
   cc: [Url; 1],
   #[serde(rename = "type")]
@@ -57,7 +57,7 @@ impl UndoBlockUserFromCommunity {
     let id = generate_activity_id(UndoType::Undo)?;
     let undo = UndoBlockUserFromCommunity {
       actor: actor.actor_id(),
-      to: PublicUrl::Public,
+      to: [PublicUrl::Public],
       object: block,
       cc: [community.actor_id()],
       kind: UndoType::Undo,
index 7539464dac706429f59b616aa40a90c15d3cbcca..88b9a62aa1e9eaaf9afc56ac842fd19282208856 100644 (file)
@@ -35,7 +35,7 @@ use url::Url;
 #[serde(rename_all = "camelCase")]
 pub struct UpdateCommunity {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   // TODO: would be nice to use a separate struct here, which only contains the fields updated here
   object: Group,
   cc: [Url; 1],
@@ -57,7 +57,7 @@ impl UpdateCommunity {
     let id = generate_activity_id(UpdateType::Update)?;
     let update = UpdateCommunity {
       actor: actor.actor_id(),
-      to: PublicUrl::Public,
+      to: [PublicUrl::Public],
       object: community.to_apub(context.pool()).await?,
       cc: [community.actor_id()],
       kind: UpdateType::Update,
index 45567288255a3239fcb49be49f27b6c1eb6b2451..cb1fdbd937435807f6b177d1fb89b37f1ece131f 100644 (file)
@@ -63,7 +63,7 @@ use url::Url;
 #[serde(rename_all = "camelCase")]
 pub struct Delete {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   pub(in crate::activities::deletion) object: Url,
   pub(in crate::activities::deletion) cc: [Url; 1],
   #[serde(rename = "type")]
@@ -139,7 +139,7 @@ impl Delete {
   ) -> Result<Delete, LemmyError> {
     Ok(Delete {
       actor: actor.actor_id(),
-      to: PublicUrl::Public,
+      to: [PublicUrl::Public],
       object: object_id,
       cc: [community.actor_id()],
       kind: DeleteType::Delete,
index 35369d4413d4324aca5cbe4b7ad770a3e6c87fb3..bec7d76c96c94f2227cc31591bd35baab40e4025 100644 (file)
@@ -39,7 +39,7 @@ use url::Url;
 #[serde(rename_all = "camelCase")]
 pub struct UndoDelete {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   object: Delete,
   cc: [Url; 1],
   #[serde(rename = "type")]
@@ -110,7 +110,7 @@ impl UndoDelete {
     let id = generate_activity_id(UndoType::Undo)?;
     let undo = UndoDelete {
       actor: actor.actor_id(),
-      to: PublicUrl::Public,
+      to: [PublicUrl::Public],
       object,
       cc: [community.actor_id()],
       kind: UndoType::Undo,
index c1b0703db534a99d68d4e44486a9b4f4dd3bc424..eff56ce211eb96c951b68ccd6c175fcac6397807 100644 (file)
@@ -35,7 +35,7 @@ use url::Url;
 #[serde(rename_all = "camelCase")]
 pub struct CreateOrUpdatePost {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   object: Page,
   cc: [Url; 1],
   #[serde(rename = "type")]
@@ -63,7 +63,7 @@ impl CreateOrUpdatePost {
     let id = generate_activity_id(kind.clone())?;
     let create_or_update = CreateOrUpdatePost {
       actor: actor.actor_id(),
-      to: PublicUrl::Public,
+      to: [PublicUrl::Public],
       object: post.to_apub(context.pool()).await?,
       cc: [community.actor_id()],
       kind,
index 03b2f888e16b71728227f90837088d5affba2e49..9720c06f107293ab6f3af0082e7399abc30cf171 100644 (file)
@@ -19,7 +19,7 @@ use url::Url;
 #[serde(rename_all = "camelCase")]
 pub struct UndoRemovePostCommentOrCommunity {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   // Note, there is no such thing as Undo/Remove/Mod, so we ignore that
   object: RemoveMod,
   cc: [Url; 1],
index 6e18b3cb6be1831c145bb61e68a395f35a547f43..0f0eb1ffbed160e546400ea182d1894eac010304 100644 (file)
@@ -42,7 +42,7 @@ use url::Url;
 #[serde(rename_all = "camelCase")]
 pub struct UndoVote {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   object: Vote,
   cc: [Url; 1],
   #[serde(rename = "type")]
@@ -71,7 +71,7 @@ impl UndoVote {
     let id = generate_activity_id(UndoType::Undo)?;
     let undo_vote = UndoVote {
       actor: actor.actor_id(),
-      to: PublicUrl::Public,
+      to: [PublicUrl::Public],
       object,
       cc: [community.actor_id()],
       kind: UndoType::Undo,
index cd7d04c54906de2d24f49575b1e0a9468b0c608c..95d09961506c8b80b98fd37dd5e4fcc3ee5c3edd 100644 (file)
@@ -62,7 +62,7 @@ impl From<&VoteType> for i16 {
 #[serde(rename_all = "camelCase")]
 pub struct Vote {
   actor: Url,
-  to: PublicUrl,
+  to: [PublicUrl; 1],
   pub(in crate::activities::voting) object: Url,
   cc: [Url; 1],
   #[serde(rename = "type")]
@@ -83,7 +83,7 @@ impl Vote {
   ) -> Result<Vote, LemmyError> {
     Ok(Vote {
       actor: actor.actor_id(),
-      to: PublicUrl::Public,
+      to: [PublicUrl::Public],
       object: object.ap_id(),
       cc: [community.actor_id()],
       kind: kind.clone(),