Browse Source

Changing some todos, adding comments.

federated_mentions
Dessalines 9 months ago
parent
commit
d7e85cebf7
6 changed files with 9 additions and 6 deletions
  1. +1
    -0
      server/src/api/comment.rs
  2. +0
    -1
      server/src/apub/activities.rs
  3. +3
    -0
      server/src/apub/comment.rs
  4. +1
    -1
      server/src/apub/mod.rs
  5. +0
    -1
      server/src/lib.rs
  6. +4
    -3
      server/src/routes/webfinger.rs

+ 1
- 0
server/src/api/comment.rs View File

@ -521,6 +521,7 @@ pub fn send_local_notifs(
.collect::<Vec<&MentionData>>()
{
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);


+ 0
- 1
server/src/apub/activities.rs View File

@ -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(())
}


+ 3
- 0
server/src/apub/comment.rs View File

@ -395,6 +395,9 @@ struct MentionsAndAddresses {
tags: Vec<Mention>,
}
/// 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,


+ 1
- 1
server/src/apub/mod.rs View File

@ -296,7 +296,7 @@ pub fn fetch_webfinger_url(mention: &MentionData) -> Result<String, Error> {
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


+ 0
- 1
server/src/lib.rs View File

@ -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);


+ 4
- 3
server/src/routes/webfinger.rs View File

@ -15,7 +15,8 @@ pub struct WebFingerResponse {
#[derive(Serialize, Deserialize, Debug)]
pub struct WebFingerLink {
pub rel: Option<String>,
pub r#type: Option<String>,
#[serde(rename(serialize = "type", deserialize = "type"))]
pub type_: Option<String>,
pub href: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub template: Option<String>,
@ -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


Loading…
Cancel
Save