Only send notifications for mentions if the post is not a draft

This commit is contained in:
Bat 2018-09-12 17:00:00 +01:00
parent b01212f4a6
commit 0200a7b223

View file

@ -200,9 +200,11 @@ fn update(blog: String, slug: String, user: User, conn: DbConn, data: LenientFor
post.update(&*conn); post.update(&*conn);
let post = post.update_ap_url(&*conn); let post = post.update_ap_url(&*conn);
if post.published {
for m in mentions.into_iter() { for m in mentions.into_iter() {
Mention::from_activity(&*conn, Mention::build_activity(&*conn, m), post.id, true, true); Mention::from_activity(&*conn, Mention::build_activity(&*conn, m), post.id, true, true);
} }
}
let old_tags = Tag::for_post(&*conn, post.id).into_iter().map(|t| t.tag).collect::<Vec<_>>(); let old_tags = Tag::for_post(&*conn, post.id).into_iter().map(|t| t.tag).collect::<Vec<_>>();
let tags = form.tags.split(",").map(|t| t.trim().to_camel_case()).filter(|t| t.len() > 0 && !old_tags.contains(t)); let tags = form.tags.split(",").map(|t| t.trim().to_camel_case()).filter(|t| t.len() > 0 && !old_tags.contains(t));