One less unhandled error

This commit is contained in:
Bat 2018-06-10 11:01:02 +01:00
parent 87d39ba27f
commit 40d87e746d

View File

@ -476,13 +476,17 @@ impl Inbox for User {
"Create" => { "Create" => {
match act["object"]["type"].as_str().unwrap() { match act["object"]["type"].as_str().unwrap() {
"Note" => { "Note" => {
let comment = Comment::find_by_ap_url(conn, act["object"]["id"].as_str().unwrap().to_string()).unwrap(); match Comment::find_by_ap_url(conn, act["object"]["id"].as_str().unwrap().to_string()) {
Notification::insert(conn, NewNotification { Some(comment) => {
title: format!("{} commented your article", comment.get_author(conn).display_name.clone()), Notification::insert(conn, NewNotification {
content: Some(comment.get_post(conn).title), title: format!("{} commented your article", comment.get_author(conn).display_name.clone()),
link: comment.ap_url, content: Some(comment.get_post(conn).title),
user_id: self.id link: comment.ap_url,
}); user_id: self.id
});
},
None => println!("Couldn't find comment by AP id, to create a new notification")
};
} }
_ => {} _ => {}
} }