Delete notifications when deleting comments (#499)
* Implement find_for_comment for notifications * Delete notifications when deleting a comment This should tackle #463 * Apply rustfmt * Implement `find_for_mention` and remove order by from `find_for_comment` There is no need to order the notifications * Delete notifications for mentions * Fix notifications for comments and mentions
This commit is contained in:
committed by
Baptiste Gelez
parent
f0d6b9d1e8
commit
c7ee779f51
@@ -330,9 +330,17 @@ impl<'a> Deletable<Connection, Delete> for Comment {
|
||||
act.object_props
|
||||
.set_to_link_vec(vec![Id::new(PUBLIC_VISIBILTY)])?;
|
||||
|
||||
for m in Mention::list_for_comment(&conn, self.id)? {
|
||||
for m in Mention::list_for_comment(conn, self.id)? {
|
||||
for n in Notification::find_for_mention(conn, &m)? {
|
||||
n.delete(conn)?;
|
||||
}
|
||||
m.delete(conn)?;
|
||||
}
|
||||
|
||||
for n in Notification::find_for_comment(conn, &self)? {
|
||||
n.delete(conn)?;
|
||||
}
|
||||
|
||||
diesel::update(comments::table)
|
||||
.filter(comments::in_response_to_id.eq(self.id))
|
||||
.set(comments::in_response_to_id.eq(self.in_response_to_id))
|
||||
|
||||
Reference in New Issue
Block a user