2022-02-07 19:23:12 +00:00
|
|
|
use crate::{activities::block::SiteOrCommunity, objects::person::ApubPerson, protocol::Unparsed};
|
2021-11-19 17:47:06 +00:00
|
|
|
use activitystreams_kinds::activity::BlockType;
|
2022-01-08 12:37:07 +00:00
|
|
|
use chrono::{DateTime, FixedOffset};
|
2021-11-05 00:24:10 +00:00
|
|
|
use lemmy_apub_lib::object_id::ObjectId;
|
2021-10-29 10:32:42 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use url::Url;
|
|
|
|
|
2021-11-03 17:33:51 +00:00
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
2021-10-29 10:32:42 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
2022-02-07 19:23:12 +00:00
|
|
|
pub struct BlockUser {
|
2021-10-29 10:32:42 +00:00
|
|
|
pub(crate) actor: ObjectId<ApubPerson>,
|
2021-11-27 04:55:33 +00:00
|
|
|
#[serde(deserialize_with = "crate::deserialize_one_or_many")]
|
2021-10-29 10:32:42 +00:00
|
|
|
pub(crate) to: Vec<Url>,
|
|
|
|
pub(crate) object: ObjectId<ApubPerson>,
|
2021-11-27 04:55:33 +00:00
|
|
|
#[serde(deserialize_with = "crate::deserialize_one_or_many")]
|
2021-10-29 10:32:42 +00:00
|
|
|
pub(crate) cc: Vec<Url>,
|
2022-02-07 19:23:12 +00:00
|
|
|
pub(crate) target: ObjectId<SiteOrCommunity>,
|
2021-10-29 10:32:42 +00:00
|
|
|
#[serde(rename = "type")]
|
|
|
|
pub(crate) kind: BlockType,
|
2022-02-07 19:23:12 +00:00
|
|
|
/// Quick and dirty solution.
|
|
|
|
/// TODO: send a separate Delete activity instead
|
|
|
|
pub(crate) remove_data: Option<bool>,
|
|
|
|
/// block reason, written to mod log
|
|
|
|
pub(crate) summary: Option<String>,
|
2021-10-29 10:32:42 +00:00
|
|
|
pub(crate) id: Url,
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub(crate) unparsed: Unparsed,
|
2022-01-08 12:37:07 +00:00
|
|
|
pub(crate) expires: Option<DateTime<FixedOffset>>,
|
2021-10-29 10:32:42 +00:00
|
|
|
}
|