#[serde(rename_all = "camelCase")]
pub struct CreateOrUpdateComment {
actor: Url,
- to: PublicUrl,
+ to: [PublicUrl; 1],
object: Note,
cc: Vec<Url>,
tag: Vec<Mention>,
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,
#[serde(rename_all = "camelCase")]
pub struct AddMod {
actor: Url,
- to: PublicUrl,
+ to: [PublicUrl; 1],
object: Url,
target: Url,
cc: [Url; 1],
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()],
#[serde(rename_all = "camelCase")]
pub struct AnnounceActivity {
actor: Url,
- to: PublicUrl,
+ to: [PublicUrl; 1],
object: AnnouncableActivities,
cc: Vec<Url>,
#[serde(rename = "type")]
) -> Result<(), LemmyError> {
let announce = AnnounceActivity {
actor: community.actor_id(),
- to: PublicUrl::Public,
+ to: [PublicUrl::Public],
object,
cc: vec![community.followers_url()],
kind: AnnounceType::Announce,
#[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")]
) -> 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,
#[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")]
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(),
#[serde(rename_all = "camelCase")]
pub struct UndoBlockUserFromCommunity {
actor: Url,
- to: PublicUrl,
+ to: [PublicUrl; 1],
object: BlockUserFromCommunity,
cc: [Url; 1],
#[serde(rename = "type")]
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,
#[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],
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,
#[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")]
) -> 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,
#[serde(rename_all = "camelCase")]
pub struct UndoDelete {
actor: Url,
- to: PublicUrl,
+ to: [PublicUrl; 1],
object: Delete,
cc: [Url; 1],
#[serde(rename = "type")]
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,
#[serde(rename_all = "camelCase")]
pub struct CreateOrUpdatePost {
actor: Url,
- to: PublicUrl,
+ to: [PublicUrl; 1],
object: Page,
cc: [Url; 1],
#[serde(rename = "type")]
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,
#[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],
#[serde(rename_all = "camelCase")]
pub struct UndoVote {
actor: Url,
- to: PublicUrl,
+ to: [PublicUrl; 1],
object: Vote,
cc: [Url; 1],
#[serde(rename = "type")]
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,
#[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")]
) -> 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(),