mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-18 09:41:01 +00:00
Send event to channel when post deleted
This commit is contained in:
parent
82524c9dca
commit
2a8cc5f3ba
1 changed files with 12 additions and 2 deletions
|
@ -93,12 +93,12 @@ impl Post {
|
|||
Ok(post)
|
||||
}
|
||||
|
||||
pub fn delete(&self, conn: &Connection, searcher: &Searcher) -> Result<()> {
|
||||
pub fn delete(&self, conn: &Connection, _searcher: &Searcher) -> Result<()> {
|
||||
for m in Mention::list_for_post(&conn, self.id)? {
|
||||
m.delete(conn)?;
|
||||
}
|
||||
diesel::delete(self).execute(conn)?;
|
||||
searcher.delete_document(self);
|
||||
self.publish_deleted();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -570,6 +570,16 @@ impl Post {
|
|||
None,
|
||||
)
|
||||
}
|
||||
|
||||
fn publish_deleted(&self) {
|
||||
POST_CHAN.tell(
|
||||
Publish {
|
||||
msg: PostDeleted(self.clone()),
|
||||
topic: "post.deleted".into(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl FromId<PlumeRocket> for Post {
|
||||
|
|
Loading…
Reference in a new issue