Changing some todos, adding comments.
This commit is contained in:
parent
1a4f7a1415
commit
d7e85cebf7
6 changed files with 9 additions and 6 deletions
|
@ -521,6 +521,7 @@ pub fn send_local_notifs(
|
||||||
.collect::<Vec<&MentionData>>()
|
.collect::<Vec<&MentionData>>()
|
||||||
{
|
{
|
||||||
if let Ok(mention_user) = User_::read_from_name(&conn, &mention.name) {
|
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
|
// 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
|
// This can cause two notifications, one for reply and the other for mention
|
||||||
recipient_ids.push(mention_user.id);
|
recipient_ids.push(mention_user.id);
|
||||||
|
|
|
@ -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: 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)
|
// TODO: handle privacy on the receiving side (at least ignore anything thats not public)
|
||||||
.set_to_xsd_any_uri(public())?
|
.set_to_xsd_any_uri(public())?
|
||||||
// .set_cc_xsd_any_uri(addressed_to)?;
|
|
||||||
.set_many_cc_xsd_any_uris(addressed_ccs)?;
|
.set_many_cc_xsd_any_uris(addressed_ccs)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,6 +395,9 @@ struct MentionsAndAddresses {
|
||||||
tags: Vec<Mention>,
|
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(
|
fn collect_non_local_mentions_and_addresses(
|
||||||
conn: &PgConnection,
|
conn: &PgConnection,
|
||||||
content: &str,
|
content: &str,
|
||||||
|
|
|
@ -296,7 +296,7 @@ pub fn fetch_webfinger_url(mention: &MentionData) -> Result<String, Error> {
|
||||||
let link = res
|
let link = res
|
||||||
.links
|
.links
|
||||||
.iter()
|
.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."))?;
|
.ok_or_else(|| format_err!("No application/activity+json link found."))?;
|
||||||
link
|
link
|
||||||
.href
|
.href
|
||||||
|
|
|
@ -271,7 +271,6 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mentions_regex() {
|
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 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);
|
let mentions = scrape_text_for_mentions(text);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ pub struct WebFingerResponse {
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct WebFingerLink {
|
pub struct WebFingerLink {
|
||||||
pub rel: Option<String>,
|
pub rel: Option<String>,
|
||||||
pub r#type: Option<String>,
|
#[serde(rename(serialize = "type", deserialize = "type"))]
|
||||||
|
pub type_: Option<String>,
|
||||||
pub href: Option<String>,
|
pub href: Option<String>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub template: Option<String>,
|
pub template: Option<String>,
|
||||||
|
@ -90,13 +91,13 @@ async fn get_webfinger_response(
|
||||||
links: vec![
|
links: vec![
|
||||||
WebFingerLink {
|
WebFingerLink {
|
||||||
rel: Some("http://webfinger.net/rel/profile-page".to_string()),
|
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()),
|
href: Some(url.to_owned()),
|
||||||
template: None,
|
template: None,
|
||||||
},
|
},
|
||||||
WebFingerLink {
|
WebFingerLink {
|
||||||
rel: Some("self".to_string()),
|
rel: Some("self".to_string()),
|
||||||
r#type: Some("application/activity+json".to_string()),
|
type_: Some("application/activity+json".to_string()),
|
||||||
href: Some(url),
|
href: Some(url),
|
||||||
template: None,
|
template: None,
|
||||||
}, // TODO: this also needs to return the subscribe link once that's implemented
|
}, // TODO: this also needs to return the subscribe link once that's implemented
|
||||||
|
|
Loading…
Reference in a new issue