diff options
author | Dessalines <tyhou13@gmx.com> | 2019-12-11 12:21:47 -0800 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2019-12-11 12:21:47 -0800 |
commit | fca8e6a0a9308340e88ad291c89c40e7d17f27be (patch) | |
tree | 7b5cdfa2323499d4f477645962baee2948f482ec /server/src/api/post.rs | |
parent | e9f476566378b6745ecb82808c0943550285c3fd (diff) |
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
Diffstat (limited to 'server/src/api/post.rs')
-rw-r--r-- | server/src/api/post.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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<CreatePostLikeResponse> for Oper<CreatePostLike> { 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() { |