Add support for blog deletion

fix #181
This commit is contained in:
Trinity Pointard
2018-10-20 15:03:59 +02:00
parent a6e73f4667
commit eca458b0e5
4 changed files with 31 additions and 2 deletions
+10 -2
View File
@@ -17,13 +17,14 @@ use webfinger::*;
use {BASE_URL, USE_HTTPS, Connection};
use plume_common::activity_pub::{
ap_accept_header, ApSignature, ActivityStream, Id, IntoId, PublicKey,
inbox::WithInbox,
inbox::{Deletable, WithInbox},
sign
};
use safe_string::SafeString;
use instance::*;
use users::User;
use posts::Post;
use schema::blogs;
use users::User;
pub type CustomGroup = CustomObject<ApSignature, Group>;
@@ -273,6 +274,13 @@ impl Blog {
json["fqn"] = json!(self.get_fqn(conn));
json
}
pub fn delete(&self, conn: &Connection) {
for post in Post::get_for_blog(conn, &self) {
post.delete(conn);
}
diesel::delete(self).execute(conn).expect("Blog::delete: blog deletion error");
}
}
impl IntoId for Blog {