From b1af17c5d2c70213b6d3e27eed105cc85509bb02 Mon Sep 17 00:00:00 2001 From: aprilthepink Date: Thu, 27 Jun 2024 17:29:55 +0200 Subject: [PATCH] fix: add mentions to TO on note import --- src/lysand/conversion.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/lysand/conversion.rs b/src/lysand/conversion.rs index f5ea97e..94d635c 100644 --- a/src/lysand/conversion.rs +++ b/src/lysand/conversion.rs @@ -126,20 +126,32 @@ pub async fn receive_lysand_note( kind: Default::default(), }) } + let mut mentions = Vec::new(); + for obj in tag.clone() { + mentions.push(obj.href.clone()); + } let to = match note .visibility .clone() .unwrap_or(super::objects::VisibilityType::Public) { super::objects::VisibilityType::Public => { - vec![public(), Url::parse(&user.followers.to_string().as_str())?] + let mut vec = vec![public(), Url::parse(&user.followers.to_string().as_str())?]; + vec.append(&mut mentions.clone()); + vec } super::objects::VisibilityType::Followers => { - vec![Url::parse(&user.followers.to_string().as_str())?] + let mut vec = vec![Url::parse(&user.followers.to_string().as_str())?]; + vec.append(&mut mentions.clone()); + vec } - super::objects::VisibilityType::Direct => note.mentions.unwrap_or_default(), + super::objects::VisibilityType::Direct => { + mentions.clone() + }, super::objects::VisibilityType::Unlisted => { - vec![Url::parse(&user.followers.to_string().as_str())?] + let mut vec = vec![Url::parse(&user.followers.to_string().as_str())?]; + vec.append(&mut mentions.clone()); + vec } }; let cc = match note