simplify ObjectId::new (and fix clippy)

rewrite-fetcher
Felix Ableitner 2021-09-24 22:11:24 +02:00
parent 24fc616774
commit a5f45a169e
28 changed files with 60 additions and 62 deletions

View File

@ -61,7 +61,7 @@ impl CreateOrUpdateComment {
let maa = collect_non_local_mentions(comment, &community, context).await?; let maa = collect_non_local_mentions(comment, &community, context).await?;
let create_or_update = CreateOrUpdateComment { let create_or_update = CreateOrUpdateComment {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(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,
@ -85,7 +85,7 @@ impl ActivityHandler for CreateOrUpdateComment {
request_counter: &mut i32, request_counter: &mut i32,
) -> Result<(), LemmyError> { ) -> Result<(), LemmyError> {
let community = extract_community(&self.cc, context, request_counter).await?; let community = extract_community(&self.cc, context, request_counter).await?;
let community_id = ObjectId::<Community>::new(community.actor_id()); let community_id = ObjectId::new(community.actor_id());
verify_activity(self)?; verify_activity(self)?;
verify_person_in_community(&self.actor, &community_id, context, request_counter).await?; verify_person_in_community(&self.actor, &community_id, context, request_counter).await?;

View File

@ -76,7 +76,7 @@ pub async fn collect_non_local_mentions(
for mention in &mentions { for mention in &mentions {
// TODO should it be fetching it every time? // TODO should it be fetching it every time?
if let Ok(actor_id) = fetch_webfinger_url(mention, context.client()).await { if let Ok(actor_id) = fetch_webfinger_url(mention, context.client()).await {
let actor_id: ObjectId<Person> = ObjectId::<Person>::new(actor_id); let actor_id: ObjectId<Person> = ObjectId::new(actor_id);
debug!("mention actor_id: {}", actor_id); debug!("mention actor_id: {}", actor_id);
addressed_ccs.push(actor_id.to_owned().to_string().parse()?); addressed_ccs.push(actor_id.to_owned().to_string().parse()?);

View File

@ -57,11 +57,11 @@ impl AddMod {
) -> Result<(), LemmyError> { ) -> Result<(), LemmyError> {
let id = generate_activity_id(AddType::Add)?; let id = generate_activity_id(AddType::Add)?;
let add = AddMod { let add = AddMod {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: [PublicUrl::Public], to: [PublicUrl::Public],
object: ObjectId::<Person>::new(added_mod.actor_id()), object: ObjectId::new(added_mod.actor_id()),
target: generate_moderators_url(&community.actor_id)?.into(), target: generate_moderators_url(&community.actor_id)?.into(),
cc: [ObjectId::<Community>::new(community.actor_id())], cc: [ObjectId::new(community.actor_id())],
kind: AddType::Add, kind: AddType::Add,
id: id.clone(), id: id.clone(),
context: lemmy_context(), context: lemmy_context(),

View File

@ -79,7 +79,7 @@ impl AnnounceActivity {
context: &LemmyContext, context: &LemmyContext,
) -> Result<(), LemmyError> { ) -> Result<(), LemmyError> {
let announce = AnnounceActivity { let announce = AnnounceActivity {
actor: ObjectId::<Community>::new(community.actor_id()), actor: ObjectId::new(community.actor_id()),
to: [PublicUrl::Public], to: [PublicUrl::Public],
object, object,
cc: vec![community.followers_url()], cc: vec![community.followers_url()],

View File

@ -58,10 +58,10 @@ impl BlockUserFromCommunity {
actor: &Person, actor: &Person,
) -> Result<BlockUserFromCommunity, LemmyError> { ) -> Result<BlockUserFromCommunity, LemmyError> {
Ok(BlockUserFromCommunity { Ok(BlockUserFromCommunity {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: [PublicUrl::Public], to: [PublicUrl::Public],
object: ObjectId::<Person>::new(target.actor_id()), object: ObjectId::new(target.actor_id()),
cc: [ObjectId::<Community>::new(community.actor_id())], cc: [ObjectId::new(community.actor_id())],
kind: BlockType::Block, kind: BlockType::Block,
id: generate_activity_id(BlockType::Block)?, id: generate_activity_id(BlockType::Block)?,
context: lemmy_context(), context: lemmy_context(),

View File

@ -59,13 +59,13 @@ impl RemoveMod {
) -> Result<(), LemmyError> { ) -> Result<(), LemmyError> {
let id = generate_activity_id(RemoveType::Remove)?; let id = generate_activity_id(RemoveType::Remove)?;
let remove = RemoveMod { let remove = RemoveMod {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: [PublicUrl::Public], to: [PublicUrl::Public],
object: ObjectId::<Person>::new(removed_mod.actor_id()), object: ObjectId::new(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(),
context: lemmy_context(), context: lemmy_context(),
cc: [ObjectId::<Community>::new(community.actor_id())], cc: [ObjectId::new(community.actor_id())],
kind: RemoveType::Remove, kind: RemoveType::Remove,
unparsed: Default::default(), unparsed: Default::default(),
}; };

View File

@ -56,10 +56,10 @@ impl UndoBlockUserFromCommunity {
let id = generate_activity_id(UndoType::Undo)?; let id = generate_activity_id(UndoType::Undo)?;
let undo = UndoBlockUserFromCommunity { let undo = UndoBlockUserFromCommunity {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: [PublicUrl::Public], to: [PublicUrl::Public],
object: block, object: block,
cc: [ObjectId::<Community>::new(community.actor_id())], cc: [ObjectId::new(community.actor_id())],
kind: UndoType::Undo, kind: UndoType::Undo,
id: id.clone(), id: id.clone(),
context: lemmy_context(), context: lemmy_context(),

View File

@ -57,10 +57,10 @@ impl UpdateCommunity {
) -> Result<(), LemmyError> { ) -> Result<(), LemmyError> {
let id = generate_activity_id(UpdateType::Update)?; let id = generate_activity_id(UpdateType::Update)?;
let update = UpdateCommunity { let update = UpdateCommunity {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: [PublicUrl::Public], to: [PublicUrl::Public],
object: community.to_apub(context.pool()).await?, object: community.to_apub(context.pool()).await?,
cc: [ObjectId::<Community>::new(community.actor_id())], cc: [ObjectId::new(community.actor_id())],
kind: UpdateType::Update, kind: UpdateType::Update,
id: id.clone(), id: id.clone(),
context: lemmy_context(), context: lemmy_context(),

View File

@ -140,10 +140,10 @@ impl Delete {
summary: Option<String>, summary: Option<String>,
) -> Result<Delete, LemmyError> { ) -> Result<Delete, LemmyError> {
Ok(Delete { Ok(Delete {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: [PublicUrl::Public], to: [PublicUrl::Public],
object: object_id, object: object_id,
cc: [ObjectId::<Community>::new(community.actor_id())], cc: [ObjectId::new(community.actor_id())],
kind: DeleteType::Delete, kind: DeleteType::Delete,
summary, summary,
id: generate_activity_id(DeleteType::Delete)?, id: generate_activity_id(DeleteType::Delete)?,

View File

@ -105,7 +105,7 @@ pub(in crate::activities) async fn verify_delete_activity(
request_counter: &mut i32, request_counter: &mut i32,
) -> Result<(), LemmyError> { ) -> Result<(), LemmyError> {
let object = DeletableObjects::read_from_db(object, context).await?; let object = DeletableObjects::read_from_db(object, context).await?;
let actor = ObjectId::<Person>::new(activity.actor().clone()); let actor = ObjectId::new(activity.actor().clone());
match object { match object {
DeletableObjects::Community(c) => { DeletableObjects::Community(c) => {
if c.local { if c.local {
@ -114,7 +114,7 @@ pub(in crate::activities) async fn verify_delete_activity(
verify_person_in_community(&actor, community_id, context, request_counter).await?; verify_person_in_community(&actor, community_id, context, request_counter).await?;
} }
// community deletion is always a mod (or admin) action // community deletion is always a mod (or admin) action
verify_mod_action(&actor, ObjectId::<Community>::new(c.actor_id()), context).await?; verify_mod_action(&actor, ObjectId::new(c.actor_id()), context).await?;
} }
DeletableObjects::Post(p) => { DeletableObjects::Post(p) => {
verify_delete_activity_post_or_comment( verify_delete_activity_post_or_comment(
@ -150,7 +150,7 @@ async fn verify_delete_activity_post_or_comment(
context: &LemmyContext, context: &LemmyContext,
request_counter: &mut i32, request_counter: &mut i32,
) -> Result<(), LemmyError> { ) -> Result<(), LemmyError> {
let actor = ObjectId::<Person>::new(activity.actor().clone()); let actor = ObjectId::new(activity.actor().clone());
verify_person_in_community(&actor, community_id, context, request_counter).await?; verify_person_in_community(&actor, community_id, context, request_counter).await?;
if is_mod_action { if is_mod_action {
verify_mod_action(&actor, community_id.clone(), context).await?; verify_mod_action(&actor, community_id.clone(), context).await?;

View File

@ -110,10 +110,10 @@ impl UndoDelete {
let id = generate_activity_id(UndoType::Undo)?; let id = generate_activity_id(UndoType::Undo)?;
let undo = UndoDelete { let undo = UndoDelete {
actor: ObjectId::<Community>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: [PublicUrl::Public], to: [PublicUrl::Public],
object, object,
cc: [ObjectId::<Community>::new(community.actor_id())], cc: [ObjectId::new(community.actor_id())],
kind: UndoType::Undo, kind: UndoType::Undo,
id: id.clone(), id: id.clone(),
context: lemmy_context(), context: lemmy_context(),

View File

@ -57,8 +57,8 @@ impl AcceptFollowCommunity {
.await??; .await??;
let accept = AcceptFollowCommunity { let accept = AcceptFollowCommunity {
actor: ObjectId::<Community>::new(community.actor_id()), actor: ObjectId::new(community.actor_id()),
to: ObjectId::<Person>::new(person.actor_id()), to: ObjectId::new(person.actor_id()),
object: follow, object: follow,
kind: AcceptType::Accept, kind: AcceptType::Accept,
id: generate_activity_id(AcceptType::Accept)?, id: generate_activity_id(AcceptType::Accept)?,

View File

@ -50,9 +50,9 @@ impl FollowCommunity {
community: &Community, community: &Community,
) -> Result<FollowCommunity, LemmyError> { ) -> Result<FollowCommunity, LemmyError> {
Ok(FollowCommunity { Ok(FollowCommunity {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: ObjectId::<Community>::new(community.actor_id()), to: ObjectId::new(community.actor_id()),
object: ObjectId::<Community>::new(community.actor_id()), object: ObjectId::new(community.actor_id()),
kind: FollowType::Follow, kind: FollowType::Follow,
id: generate_activity_id(FollowType::Follow)?, id: generate_activity_id(FollowType::Follow)?,
context: lemmy_context(), context: lemmy_context(),

View File

@ -51,8 +51,8 @@ impl UndoFollowCommunity {
) -> Result<(), LemmyError> { ) -> Result<(), LemmyError> {
let object = FollowCommunity::new(actor, community)?; let object = FollowCommunity::new(actor, community)?;
let undo = UndoFollowCommunity { let undo = UndoFollowCommunity {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: ObjectId::<Community>::new(community.actor_id()), to: ObjectId::new(community.actor_id()),
object, object,
kind: UndoType::Undo, kind: UndoType::Undo,
id: generate_activity_id(UndoType::Undo)?, id: generate_activity_id(UndoType::Undo)?,

View File

@ -58,7 +58,7 @@ pub(crate) async fn extract_community(
let mut cc_iter = cc.iter(); let mut cc_iter = cc.iter();
loop { loop {
if let Some(cid) = cc_iter.next() { if let Some(cid) = cc_iter.next() {
let cid = ObjectId::<Community>::new(cid.clone()); let cid = ObjectId::new(cid.clone());
if let Ok(c) = cid.dereference(context, request_counter).await { if let Ok(c) = cid.dereference(context, request_counter).await {
break Ok(c); break Ok(c);
} }

View File

@ -61,10 +61,10 @@ 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: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: [PublicUrl::Public], to: [PublicUrl::Public],
object: post.to_apub(context.pool()).await?, object: post.to_apub(context.pool()).await?,
cc: [ObjectId::<Community>::new(community.actor_id())], cc: [ObjectId::new(community.actor_id())],
kind, kind,
id: id.clone(), id: id.clone(),
context: lemmy_context(), context: lemmy_context(),

View File

@ -46,8 +46,8 @@ impl CreateOrUpdatePrivateMessage {
let create_or_update = CreateOrUpdatePrivateMessage { let create_or_update = CreateOrUpdatePrivateMessage {
context: lemmy_context(), context: lemmy_context(),
id: id.clone(), id: id.clone(),
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: ObjectId::<Person>::new(recipient.actor_id()), to: ObjectId::new(recipient.actor_id()),
object: private_message.to_apub(context.pool()).await?, object: private_message.to_apub(context.pool()).await?,
kind, kind,
unparsed: Default::default(), unparsed: Default::default(),

View File

@ -41,8 +41,8 @@ impl DeletePrivateMessage {
pm: &PrivateMessage, pm: &PrivateMessage,
) -> Result<DeletePrivateMessage, LemmyError> { ) -> Result<DeletePrivateMessage, LemmyError> {
Ok(DeletePrivateMessage { Ok(DeletePrivateMessage {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: ObjectId::<Person>::new(actor.actor_id()), to: ObjectId::new(actor.actor_id()),
object: pm.ap_id.clone().into(), object: pm.ap_id.clone().into(),
kind: DeleteType::Delete, kind: DeleteType::Delete,
id: generate_activity_id(DeleteType::Delete)?, id: generate_activity_id(DeleteType::Delete)?,

View File

@ -53,8 +53,8 @@ impl UndoDeletePrivateMessage {
let object = DeletePrivateMessage::new(actor, pm)?; let object = DeletePrivateMessage::new(actor, pm)?;
let id = generate_activity_id(UndoType::Undo)?; let id = generate_activity_id(UndoType::Undo)?;
let undo = UndoDeletePrivateMessage { let undo = UndoDeletePrivateMessage {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: ObjectId::<Person>::new(recipient.actor_id()), to: ObjectId::new(recipient.actor_id()),
object, object,
kind: UndoType::Undo, kind: UndoType::Undo,
id: id.clone(), id: id.clone(),

View File

@ -67,10 +67,10 @@ impl UndoVote {
let object = Vote::new(object, actor, &community, kind.clone())?; let object = Vote::new(object, actor, &community, kind.clone())?;
let id = generate_activity_id(UndoType::Undo)?; let id = generate_activity_id(UndoType::Undo)?;
let undo_vote = UndoVote { let undo_vote = UndoVote {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: [PublicUrl::Public], to: [PublicUrl::Public],
object, object,
cc: [ObjectId::<Community>::new(community.actor_id())], cc: [ObjectId::new(community.actor_id())],
kind: UndoType::Undo, kind: UndoType::Undo,
id: id.clone(), id: id.clone(),
context: lemmy_context(), context: lemmy_context(),

View File

@ -79,10 +79,10 @@ impl Vote {
kind: VoteType, kind: VoteType,
) -> Result<Vote, LemmyError> { ) -> Result<Vote, LemmyError> {
Ok(Vote { Ok(Vote {
actor: ObjectId::<Person>::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
to: [PublicUrl::Public], to: [PublicUrl::Public],
object: ObjectId::<PostOrComment>::new(object.ap_id()), object: ObjectId::new(object.ap_id()),
cc: [ObjectId::<Community>::new(community.actor_id())], cc: [ObjectId::new(community.actor_id())],
kind: kind.clone(), kind: kind.clone(),
id: generate_activity_id(kind)?, id: generate_activity_id(kind)?,
context: lemmy_context(), context: lemmy_context(),

View File

@ -45,8 +45,8 @@ pub(crate) async fn update_community_mods(
// Add new mods to database which have been added to moderators collection // Add new mods to database which have been added to moderators collection
for mod_id in new_moderators { for mod_id in new_moderators {
let mod_id = ObjectId::<Person>::new::<Person, Url>(mod_id); let mod_id = ObjectId::new(mod_id);
let mod_user = mod_id.dereference(context, request_counter).await?; let mod_user: Person = mod_id.dereference(context, request_counter).await?;
if !current_moderators if !current_moderators
.clone() .clone()

View File

@ -28,12 +28,12 @@ pub(crate) async fn get_or_fetch_and_upsert_actor(
context: &LemmyContext, context: &LemmyContext,
recursion_counter: &mut i32, recursion_counter: &mut i32,
) -> Result<Box<dyn ActorType>, LemmyError> { ) -> Result<Box<dyn ActorType>, LemmyError> {
let community_id: ObjectId<Community> = ObjectId::<Community>::new(apub_id.clone()); let community_id = ObjectId::<Community>::new(apub_id.clone());
let community = community_id.dereference(context, recursion_counter).await; let community = community_id.dereference(context, recursion_counter).await;
let actor: Box<dyn ActorType> = match community { let actor: Box<dyn ActorType> = match community {
Ok(c) => Box::new(c), Ok(c) => Box::new(c),
Err(_) => { Err(_) => {
let person_id: ObjectId<Person> = ObjectId::<Person>::new(apub_id); let person_id = ObjectId::new(apub_id);
let person: Person = person_id.dereference(context, recursion_counter).await?; let person: Person = person_id.dereference(context, recursion_counter).await?;
Box::new(person) Box::new(person)
} }

View File

@ -34,13 +34,11 @@ where
Kind: FromApub + ApubObject + DeletableApubObject + Send + 'static, Kind: FromApub + ApubObject + DeletableApubObject + Send + 'static,
for<'de> <Kind as FromApub>::ApubType: serde::Deserialize<'de>, for<'de> <Kind as FromApub>::ApubType: serde::Deserialize<'de>,
{ {
pub fn new<K, T>(url: T) -> ObjectId<K> pub fn new<T>(url: T) -> Self
where where
T: Into<Url>, T: Into<Url>,
K: FromApub + ApubObject + DeletableApubObject + Send + 'static,
for<'de> <K as FromApub>::ApubType: serde::Deserialize<'de>,
{ {
ObjectId(url.into(), PhantomData::<K>) ObjectId(url.into(), PhantomData::<Kind>)
} }
pub fn inner(&self) -> &Url { pub fn inner(&self) -> &Url {

View File

@ -55,7 +55,7 @@ pub async fn search_by_apub_id(
}; };
let request_counter = &mut 0; let request_counter = &mut 0;
ObjectId::<SearchableObjects>::new(query_url) ObjectId::new(query_url)
.dereference(context, request_counter) .dereference(context, request_counter)
.await .await
} }

View File

@ -82,14 +82,14 @@ impl Note {
CommentInReplyToMigration::Old(in_reply_to) => { CommentInReplyToMigration::Old(in_reply_to) => {
// This post, or the parent comment might not yet exist on this server yet, fetch them. // This post, or the parent comment might not yet exist on this server yet, fetch them.
let post_id = in_reply_to.get(0).context(location_info!())?; let post_id = in_reply_to.get(0).context(location_info!())?;
let post_id = ObjectId::<Post>::new(post_id.clone()); let post_id = ObjectId::new(post_id.clone());
let post = Box::pin(post_id.dereference(context, request_counter)).await?; let post = Box::pin(post_id.dereference(context, request_counter)).await?;
// The 2nd item, if it exists, is the parent comment apub_id // The 2nd item, if it exists, is the parent comment apub_id
// Nested comments will automatically get fetched recursively // Nested comments will automatically get fetched recursively
let parent_id: Option<CommentId> = match in_reply_to.get(1) { let parent_id: Option<CommentId> = match in_reply_to.get(1) {
Some(comment_id) => { Some(comment_id) => {
let comment_id: ObjectId<Comment> = ObjectId::<Comment>::new(comment_id.clone()); let comment_id = ObjectId::<Comment>::new(comment_id.clone());
let parent_comment = Box::pin(comment_id.dereference(context, request_counter)).await?; let parent_comment = Box::pin(comment_id.dereference(context, request_counter)).await?;
Some(parent_comment.id) Some(parent_comment.id)
@ -137,7 +137,7 @@ impl Note {
verify_domains_match(self.attributed_to.inner(), &self.id)?; verify_domains_match(self.attributed_to.inner(), &self.id)?;
verify_person_in_community( verify_person_in_community(
&self.attributed_to, &self.attributed_to,
&ObjectId::<Community>::new(community.actor_id()), &ObjectId::new(community.actor_id()),
context, context,
request_counter, request_counter,
) )
@ -171,7 +171,7 @@ impl ToApub for Comment {
context: lemmy_context(), context: lemmy_context(),
r#type: NoteType::Note, r#type: NoteType::Note,
id: self.ap_id.to_owned().into_inner(), id: self.ap_id.to_owned().into_inner(),
attributed_to: ObjectId::<Person>::new(creator.actor_id), attributed_to: ObjectId::new(creator.actor_id),
to: PublicUrl::Public, to: PublicUrl::Public,
content: self.content.clone(), content: self.content.clone(),
media_type: MediaTypeHtml::Html, media_type: MediaTypeHtml::Html,

View File

@ -104,7 +104,7 @@ impl Page {
verify_domains_match(self.attributed_to.inner(), &self.id)?; verify_domains_match(self.attributed_to.inner(), &self.id)?;
verify_person_in_community( verify_person_in_community(
&self.attributed_to, &self.attributed_to,
&ObjectId::<Community>::new(community.actor_id()), &ObjectId::new(community.actor_id()),
context, context,
request_counter, request_counter,
) )
@ -137,7 +137,7 @@ impl ToApub for Post {
context: lemmy_context(), context: lemmy_context(),
r#type: PageType::Page, r#type: PageType::Page,
id: self.ap_id.clone().into(), id: self.ap_id.clone().into(),
attributed_to: ObjectId::<Person>::new(creator.actor_id), attributed_to: ObjectId::new(creator.actor_id),
to: [community.actor_id.into(), public()], to: [community.actor_id.into(), public()],
name: self.name.clone(), name: self.name.clone(),
content: self.body.as_ref().map(|b| markdown_to_html(b)), content: self.body.as_ref().map(|b| markdown_to_html(b)),

View File

@ -87,8 +87,8 @@ impl ToApub for PrivateMessage {
context: lemmy_context(), context: lemmy_context(),
r#type: NoteType::Note, r#type: NoteType::Note,
id: self.ap_id.clone().into(), id: self.ap_id.clone().into(),
attributed_to: ObjectId::<Person>::new(creator.actor_id), attributed_to: ObjectId::new(creator.actor_id),
to: ObjectId::<Person>::new(recipient.actor_id), to: ObjectId::new(recipient.actor_id),
content: self.content.clone(), content: self.content.clone(),
media_type: MediaTypeHtml::Html, media_type: MediaTypeHtml::Html,
source: Source { source: Source {