Only notify for mention if it is not in a comment

To avoid two similar notifications
This commit is contained in:
Bat
2018-09-08 12:52:27 +01:00
parent b53a078b49
commit 0f5f9101b6
4 changed files with 15 additions and 8 deletions
+5 -2
View File
@@ -109,8 +109,11 @@ impl FromActivity<Note, PgConnection> for Comment {
if let Some(serde_json::Value::Array(tags)) = note.object_props.tag.clone() {
for tag in tags.into_iter() {
serde_json::from_value::<link::Mention>(tag)
.map(|m| Mention::from_activity(conn, m, comm.id, false))
.ok();
.map(|m| {
let author = &Post::get(conn, comm.post_id).unwrap().get_authors(conn)[0];
let not_author = m.link_props.href_string().expect("Comment mention: no href") != author.ap_url.clone();
Mention::from_activity(conn, m, comm.id, false, not_author)
}).ok();
}
}