mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-02 01:01:20 +00:00
Change public activities to field to array (#1739)
This commit is contained in:
parent
2c8003a9fa
commit
2822f5a126
13 changed files with 25 additions and 25 deletions
|
@ -27,7 +27,7 @@ use url::Url;
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateOrUpdateComment {
|
pub struct CreateOrUpdateComment {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
object: Note,
|
object: Note,
|
||||||
cc: Vec<Url>,
|
cc: Vec<Url>,
|
||||||
tag: Vec<Mention>,
|
tag: Vec<Mention>,
|
||||||
|
@ -61,7 +61,7 @@ impl CreateOrUpdateComment {
|
||||||
|
|
||||||
let create_or_update = CreateOrUpdateComment {
|
let create_or_update = CreateOrUpdateComment {
|
||||||
actor: actor.actor_id(),
|
actor: actor.actor_id(),
|
||||||
to: PublicUrl::Public,
|
to: [PublicUrl::Public],
|
||||||
object: comment.to_apub(context.pool()).await?,
|
object: comment.to_apub(context.pool()).await?,
|
||||||
cc: maa.ccs,
|
cc: maa.ccs,
|
||||||
tag: maa.tags,
|
tag: maa.tags,
|
||||||
|
|
|
@ -35,7 +35,7 @@ use url::Url;
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct AddMod {
|
pub struct AddMod {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
object: Url,
|
object: Url,
|
||||||
target: Url,
|
target: Url,
|
||||||
cc: [Url; 1],
|
cc: [Url; 1],
|
||||||
|
@ -58,7 +58,7 @@ impl AddMod {
|
||||||
let id = generate_activity_id(AddType::Add)?;
|
let id = generate_activity_id(AddType::Add)?;
|
||||||
let add = AddMod {
|
let add = AddMod {
|
||||||
actor: actor.actor_id(),
|
actor: actor.actor_id(),
|
||||||
to: PublicUrl::Public,
|
to: [PublicUrl::Public],
|
||||||
object: added_mod.actor_id(),
|
object: added_mod.actor_id(),
|
||||||
target: generate_moderators_url(&community.actor_id)?.into(),
|
target: generate_moderators_url(&community.actor_id)?.into(),
|
||||||
cc: [community.actor_id()],
|
cc: [community.actor_id()],
|
||||||
|
|
|
@ -58,7 +58,7 @@ pub enum AnnouncableActivities {
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct AnnounceActivity {
|
pub struct AnnounceActivity {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
object: AnnouncableActivities,
|
object: AnnouncableActivities,
|
||||||
cc: Vec<Url>,
|
cc: Vec<Url>,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
@ -79,7 +79,7 @@ impl AnnounceActivity {
|
||||||
) -> Result<(), LemmyError> {
|
) -> Result<(), LemmyError> {
|
||||||
let announce = AnnounceActivity {
|
let announce = AnnounceActivity {
|
||||||
actor: community.actor_id(),
|
actor: community.actor_id(),
|
||||||
to: PublicUrl::Public,
|
to: [PublicUrl::Public],
|
||||||
object,
|
object,
|
||||||
cc: vec![community.followers_url()],
|
cc: vec![community.followers_url()],
|
||||||
kind: AnnounceType::Announce,
|
kind: AnnounceType::Announce,
|
||||||
|
|
|
@ -39,7 +39,7 @@ use url::Url;
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct BlockUserFromCommunity {
|
pub struct BlockUserFromCommunity {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
pub(in crate::activities::community) object: Url,
|
pub(in crate::activities::community) object: Url,
|
||||||
cc: [Url; 1],
|
cc: [Url; 1],
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
@ -59,7 +59,7 @@ impl BlockUserFromCommunity {
|
||||||
) -> Result<BlockUserFromCommunity, LemmyError> {
|
) -> Result<BlockUserFromCommunity, LemmyError> {
|
||||||
Ok(BlockUserFromCommunity {
|
Ok(BlockUserFromCommunity {
|
||||||
actor: actor.actor_id(),
|
actor: actor.actor_id(),
|
||||||
to: PublicUrl::Public,
|
to: [PublicUrl::Public],
|
||||||
object: target.actor_id(),
|
object: target.actor_id(),
|
||||||
cc: [community.actor_id()],
|
cc: [community.actor_id()],
|
||||||
kind: BlockType::Block,
|
kind: BlockType::Block,
|
||||||
|
|
|
@ -36,7 +36,7 @@ use url::Url;
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RemoveMod {
|
pub struct RemoveMod {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
pub(in crate::activities) object: Url,
|
pub(in crate::activities) object: Url,
|
||||||
cc: [Url; 1],
|
cc: [Url; 1],
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
@ -60,7 +60,7 @@ impl RemoveMod {
|
||||||
let id = generate_activity_id(RemoveType::Remove)?;
|
let id = generate_activity_id(RemoveType::Remove)?;
|
||||||
let remove = RemoveMod {
|
let remove = RemoveMod {
|
||||||
actor: actor.actor_id(),
|
actor: actor.actor_id(),
|
||||||
to: PublicUrl::Public,
|
to: [PublicUrl::Public],
|
||||||
object: removed_mod.actor_id(),
|
object: removed_mod.actor_id(),
|
||||||
target: Some(generate_moderators_url(&community.actor_id)?.into()),
|
target: Some(generate_moderators_url(&community.actor_id)?.into()),
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
|
|
|
@ -33,7 +33,7 @@ use url::Url;
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct UndoBlockUserFromCommunity {
|
pub struct UndoBlockUserFromCommunity {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
object: BlockUserFromCommunity,
|
object: BlockUserFromCommunity,
|
||||||
cc: [Url; 1],
|
cc: [Url; 1],
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
@ -57,7 +57,7 @@ impl UndoBlockUserFromCommunity {
|
||||||
let id = generate_activity_id(UndoType::Undo)?;
|
let id = generate_activity_id(UndoType::Undo)?;
|
||||||
let undo = UndoBlockUserFromCommunity {
|
let undo = UndoBlockUserFromCommunity {
|
||||||
actor: actor.actor_id(),
|
actor: actor.actor_id(),
|
||||||
to: PublicUrl::Public,
|
to: [PublicUrl::Public],
|
||||||
object: block,
|
object: block,
|
||||||
cc: [community.actor_id()],
|
cc: [community.actor_id()],
|
||||||
kind: UndoType::Undo,
|
kind: UndoType::Undo,
|
||||||
|
|
|
@ -35,7 +35,7 @@ use url::Url;
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct UpdateCommunity {
|
pub struct UpdateCommunity {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
// TODO: would be nice to use a separate struct here, which only contains the fields updated here
|
// TODO: would be nice to use a separate struct here, which only contains the fields updated here
|
||||||
object: Group,
|
object: Group,
|
||||||
cc: [Url; 1],
|
cc: [Url; 1],
|
||||||
|
@ -57,7 +57,7 @@ impl UpdateCommunity {
|
||||||
let id = generate_activity_id(UpdateType::Update)?;
|
let id = generate_activity_id(UpdateType::Update)?;
|
||||||
let update = UpdateCommunity {
|
let update = UpdateCommunity {
|
||||||
actor: actor.actor_id(),
|
actor: actor.actor_id(),
|
||||||
to: PublicUrl::Public,
|
to: [PublicUrl::Public],
|
||||||
object: community.to_apub(context.pool()).await?,
|
object: community.to_apub(context.pool()).await?,
|
||||||
cc: [community.actor_id()],
|
cc: [community.actor_id()],
|
||||||
kind: UpdateType::Update,
|
kind: UpdateType::Update,
|
||||||
|
|
|
@ -63,7 +63,7 @@ use url::Url;
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Delete {
|
pub struct Delete {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
pub(in crate::activities::deletion) object: Url,
|
pub(in crate::activities::deletion) object: Url,
|
||||||
pub(in crate::activities::deletion) cc: [Url; 1],
|
pub(in crate::activities::deletion) cc: [Url; 1],
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
@ -139,7 +139,7 @@ impl Delete {
|
||||||
) -> Result<Delete, LemmyError> {
|
) -> Result<Delete, LemmyError> {
|
||||||
Ok(Delete {
|
Ok(Delete {
|
||||||
actor: actor.actor_id(),
|
actor: actor.actor_id(),
|
||||||
to: PublicUrl::Public,
|
to: [PublicUrl::Public],
|
||||||
object: object_id,
|
object: object_id,
|
||||||
cc: [community.actor_id()],
|
cc: [community.actor_id()],
|
||||||
kind: DeleteType::Delete,
|
kind: DeleteType::Delete,
|
||||||
|
|
|
@ -39,7 +39,7 @@ use url::Url;
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct UndoDelete {
|
pub struct UndoDelete {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
object: Delete,
|
object: Delete,
|
||||||
cc: [Url; 1],
|
cc: [Url; 1],
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
@ -110,7 +110,7 @@ impl UndoDelete {
|
||||||
let id = generate_activity_id(UndoType::Undo)?;
|
let id = generate_activity_id(UndoType::Undo)?;
|
||||||
let undo = UndoDelete {
|
let undo = UndoDelete {
|
||||||
actor: actor.actor_id(),
|
actor: actor.actor_id(),
|
||||||
to: PublicUrl::Public,
|
to: [PublicUrl::Public],
|
||||||
object,
|
object,
|
||||||
cc: [community.actor_id()],
|
cc: [community.actor_id()],
|
||||||
kind: UndoType::Undo,
|
kind: UndoType::Undo,
|
||||||
|
|
|
@ -35,7 +35,7 @@ use url::Url;
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateOrUpdatePost {
|
pub struct CreateOrUpdatePost {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
object: Page,
|
object: Page,
|
||||||
cc: [Url; 1],
|
cc: [Url; 1],
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
@ -63,7 +63,7 @@ impl CreateOrUpdatePost {
|
||||||
let id = generate_activity_id(kind.clone())?;
|
let id = generate_activity_id(kind.clone())?;
|
||||||
let create_or_update = CreateOrUpdatePost {
|
let create_or_update = CreateOrUpdatePost {
|
||||||
actor: actor.actor_id(),
|
actor: actor.actor_id(),
|
||||||
to: PublicUrl::Public,
|
to: [PublicUrl::Public],
|
||||||
object: post.to_apub(context.pool()).await?,
|
object: post.to_apub(context.pool()).await?,
|
||||||
cc: [community.actor_id()],
|
cc: [community.actor_id()],
|
||||||
kind,
|
kind,
|
||||||
|
|
|
@ -19,7 +19,7 @@ use url::Url;
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct UndoRemovePostCommentOrCommunity {
|
pub struct UndoRemovePostCommentOrCommunity {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
// Note, there is no such thing as Undo/Remove/Mod, so we ignore that
|
// Note, there is no such thing as Undo/Remove/Mod, so we ignore that
|
||||||
object: RemoveMod,
|
object: RemoveMod,
|
||||||
cc: [Url; 1],
|
cc: [Url; 1],
|
||||||
|
|
|
@ -42,7 +42,7 @@ use url::Url;
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct UndoVote {
|
pub struct UndoVote {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
object: Vote,
|
object: Vote,
|
||||||
cc: [Url; 1],
|
cc: [Url; 1],
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
@ -71,7 +71,7 @@ impl UndoVote {
|
||||||
let id = generate_activity_id(UndoType::Undo)?;
|
let id = generate_activity_id(UndoType::Undo)?;
|
||||||
let undo_vote = UndoVote {
|
let undo_vote = UndoVote {
|
||||||
actor: actor.actor_id(),
|
actor: actor.actor_id(),
|
||||||
to: PublicUrl::Public,
|
to: [PublicUrl::Public],
|
||||||
object,
|
object,
|
||||||
cc: [community.actor_id()],
|
cc: [community.actor_id()],
|
||||||
kind: UndoType::Undo,
|
kind: UndoType::Undo,
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl From<&VoteType> for i16 {
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Vote {
|
pub struct Vote {
|
||||||
actor: Url,
|
actor: Url,
|
||||||
to: PublicUrl,
|
to: [PublicUrl; 1],
|
||||||
pub(in crate::activities::voting) object: Url,
|
pub(in crate::activities::voting) object: Url,
|
||||||
cc: [Url; 1],
|
cc: [Url; 1],
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
@ -83,7 +83,7 @@ impl Vote {
|
||||||
) -> Result<Vote, LemmyError> {
|
) -> Result<Vote, LemmyError> {
|
||||||
Ok(Vote {
|
Ok(Vote {
|
||||||
actor: actor.actor_id(),
|
actor: actor.actor_id(),
|
||||||
to: PublicUrl::Public,
|
to: [PublicUrl::Public],
|
||||||
object: object.ap_id(),
|
object: object.ap_id(),
|
||||||
cc: [community.actor_id()],
|
cc: [community.actor_id()],
|
||||||
kind: kind.clone(),
|
kind: kind.clone(),
|
||||||
|
|
Loading…
Reference in a new issue