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:
Valentin Brandl
2019-03-26 12:45:17 +01:00
committed by Baptiste Gelez
parent f0d6b9d1e8
commit c7ee779f51
4 changed files with 58 additions and 23 deletions
+8 -3
View File
@@ -7,7 +7,11 @@ use validator::Validate;
use std::time::Duration;
use plume_common::{
activity_pub::{broadcast, inbox::Deletable, ActivityStream, ApRequest},
activity_pub::{
broadcast,
inbox::{Deletable, Notify},
ActivityStream, ApRequest,
},
utils,
};
use plume_models::{
@@ -60,6 +64,7 @@ pub fn create(
},
)
.expect("comments::create: insert error");
comm.notify(&*conn).expect("comments::create: notify error");
let new_comment = comm
.create_activity(&*conn)
.expect("comments::create: activity error");
@@ -70,8 +75,8 @@ pub fn create(
&*conn,
&Mention::build_activity(&*conn, &ment)
.expect("comments::create: build mention error"),
post.id,
true,
comm.id,
false,
true,
)
.expect("comments::create: mention save error");