summaryrefslogtreecommitdiffstats
path: root/server/src/api/community.rs
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-05-01 10:07:38 -0400
committerDessalines <tyhou13@gmx.com>2020-05-01 10:07:38 -0400
commit2f1cd9976dbdc034836a01748086056999aff52a (patch)
tree8abfa5764773ba91923794590468c5c52b460303 /server/src/api/community.rs
parent461114c143aebf02f70de2b21d8b1272f67f12a2 (diff)
Adding federated community, comment, and post deletes.
- Unit tests added too. - No undeletes working yet.
Diffstat (limited to 'server/src/api/community.rs')
-rw-r--r--server/src/api/community.rs7
1 files changed, 4 insertions, 3 deletions
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<EditCommunity> {
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<EditCommunity> {
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<TransferCommunity> {
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,