From 2f1cd9976dbdc034836a01748086056999aff52a Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 1 May 2020 10:07:38 -0400 Subject: Adding federated community, comment, and post deletes. - Unit tests added too. - No undeletes working yet. --- server/src/api/community.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'server/src/api/community.rs') diff --git a/server/src/api/community.rs b/server/src/api/community.rs index d7f16c50..a0842431 100644 --- a/server/src/api/community.rs +++ b/server/src/api/community.rs @@ -321,7 +321,8 @@ impl Perform for Oper { let conn = pool.get()?; // Check for a site ban - if UserView::read(&conn, user_id)?.banned { + let user = User_::read(&conn, user_id)?; + if user.banned { return Err(APIError::err("site_ban").into()); } @@ -381,7 +382,7 @@ impl Perform for Oper { if let Some(deleted) = data.deleted.to_owned() { if deleted { - updated_community.send_delete(&conn)?; + updated_community.send_delete(&user, &conn)?; } else { // TODO: undo delete } @@ -709,7 +710,7 @@ impl Perform for Oper { title: read_community.title, description: read_community.description, category_id: read_community.category_id, - creator_id: data.user_id, + creator_id: data.user_id, // This makes the new user the community creator removed: None, deleted: None, nsfw: read_community.nsfw, -- cgit v1.2.3