Changing some todos, adding comments.

This commit is contained in:
Dessalines 2020-05-15 12:31:06 -04:00
parent 1a4f7a1415
commit d7e85cebf7
6 changed files with 9 additions and 6 deletions

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

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

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,

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

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

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