From d7e85cebf76a207ab344fd80ab4f6d28d5bcc7b5 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 15 May 2020 12:31:06 -0400 Subject: [PATCH] Changing some todos, adding comments. --- server/src/api/comment.rs | 1 + server/src/apub/activities.rs | 1 - server/src/apub/comment.rs | 3 +++ server/src/apub/mod.rs | 2 +- server/src/lib.rs | 1 - server/src/routes/webfinger.rs | 7 ++++--- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/server/src/api/comment.rs b/server/src/api/comment.rs index 137b8436f..f469b4622 100644 --- a/server/src/api/comment.rs +++ b/server/src/api/comment.rs @@ -521,6 +521,7 @@ pub fn send_local_notifs( .collect::>() { if let Ok(mention_user) = User_::read_from_name(&conn, &mention.name) { + // TODO // At some point, make it so you can't tag the parent creator either // This can cause two notifications, one for reply and the other for mention recipient_ids.push(mention_user.id); diff --git a/server/src/apub/activities.rs b/server/src/apub/activities.rs index 4013f2ac5..9fc1fa1f4 100644 --- a/server/src/apub/activities.rs +++ b/server/src/apub/activities.rs @@ -12,7 +12,6 @@ pub fn populate_object_props( // TODO: should to/cc go on the Create, or on the Post? or on both? // TODO: handle privacy on the receiving side (at least ignore anything thats not public) .set_to_xsd_any_uri(public())? - // .set_cc_xsd_any_uri(addressed_to)?; .set_many_cc_xsd_any_uris(addressed_ccs)?; Ok(()) } diff --git a/server/src/apub/comment.rs b/server/src/apub/comment.rs index 2b0070480..f746fc0ff 100644 --- a/server/src/apub/comment.rs +++ b/server/src/apub/comment.rs @@ -395,6 +395,9 @@ struct MentionsAndAddresses { tags: Vec, } +/// This takes a comment, and builds a list of to_addresses, inboxes, +/// and mention tags, so they know where to be sent to. +/// Addresses are the users / addresses that go in the cc field. fn collect_non_local_mentions_and_addresses( conn: &PgConnection, content: &str, diff --git a/server/src/apub/mod.rs b/server/src/apub/mod.rs index 157a80b3d..9d4a60106 100644 --- a/server/src/apub/mod.rs +++ b/server/src/apub/mod.rs @@ -296,7 +296,7 @@ pub fn fetch_webfinger_url(mention: &MentionData) -> Result { let link = res .links .iter() - .find(|l| l.r#type.eq(&Some("application/activity+json".to_string()))) + .find(|l| l.type_.eq(&Some("application/activity+json".to_string()))) .ok_or_else(|| format_err!("No application/activity+json link found."))?; link .href diff --git a/server/src/lib.rs b/server/src/lib.rs index fa11f528a..b68e2af58 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -271,7 +271,6 @@ mod tests { #[test] fn test_mentions_regex() { - // TODO let text = "Just read a great blog post by [@tedu@honk.teduangst.com](/u/test). And another by !test_community@fish.teduangst.com . Another [@lemmy@lemmy_alpha:8540](/u/fish)"; let mentions = scrape_text_for_mentions(text); diff --git a/server/src/routes/webfinger.rs b/server/src/routes/webfinger.rs index 0b3e21830..439064ad7 100644 --- a/server/src/routes/webfinger.rs +++ b/server/src/routes/webfinger.rs @@ -15,7 +15,8 @@ pub struct WebFingerResponse { #[derive(Serialize, Deserialize, Debug)] pub struct WebFingerLink { pub rel: Option, - pub r#type: Option, + #[serde(rename(serialize = "type", deserialize = "type"))] + pub type_: Option, pub href: Option, #[serde(skip_serializing_if = "Option::is_none")] pub template: Option, @@ -90,13 +91,13 @@ async fn get_webfinger_response( links: vec![ WebFingerLink { rel: Some("http://webfinger.net/rel/profile-page".to_string()), - r#type: Some("text/html".to_string()), + type_: Some("text/html".to_string()), href: Some(url.to_owned()), template: None, }, WebFingerLink { rel: Some("self".to_string()), - r#type: Some("application/activity+json".to_string()), + type_: Some("application/activity+json".to_string()), href: Some(url), template: None, }, // TODO: this also needs to return the subscribe link once that's implemented