From fca8e6a0a9308340e88ad291c89c40e7d17f27be Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 11 Dec 2019 12:21:47 -0800 Subject: Adding some site oriented settings. - Adding option to close registration. Fixes #350 - Adding option to disable showing NSFW buttons. Fixes #364 - Adding option to disable downvotes. Fixes #239 --- server/src/api/post.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'server/src/api/post.rs') diff --git a/server/src/api/post.rs b/server/src/api/post.rs index 0b54840f..4b2395a8 100644 --- a/server/src/api/post.rs +++ b/server/src/api/post.rs @@ -265,6 +265,14 @@ impl Perform for Oper { let user_id = claims.id; + // Don't do a downvote if site has downvotes disabled + if data.score == -1 { + let site = SiteView::read(&conn)?; + if site.enable_downvotes == false { + return Err(APIError::err(&self.op, "downvotes_disabled"))?; + } + } + // Check for a community ban let post = Post::read(&conn, data.post_id)?; if CommunityUserBanView::get(&conn, user_id, post.community_id).is_ok() { -- cgit v1.2.3