From: Felix Ableitner Date: Fri, 9 Oct 2020 13:41:40 +0000 (+0200) Subject: Respect disable downvotes setting when federating X-Git-Url: http://these/git/%22%7Burl%7D/static/git-favicon.png?a=commitdiff_plain;h=c90c96fbf60001a48e988a92504f41abcb510f33;p=lemmy.git Respect disable downvotes setting when federating --- diff --git a/lemmy_apub/src/inbox/activities/dislike.rs b/lemmy_apub/src/inbox/activities/dislike.rs index dd63011d..06a7a006 100644 --- a/lemmy_apub/src/inbox/activities/dislike.rs +++ b/lemmy_apub/src/inbox/activities/dislike.rs @@ -16,6 +16,8 @@ use lemmy_db::{ comment_view::CommentView, post::{PostForm, PostLike, PostLikeForm}, post_view::PostView, + site::Site, + Crud, Likeable, }; use lemmy_structs::{blocking, comment::CommentResponse, post::PostResponse}; @@ -30,6 +32,14 @@ pub async fn receive_dislike( activity: AnyBase, context: &LemmyContext, ) -> Result { + let enable_downvotes = blocking(context.pool(), move |conn| { + Site::read(conn, 1).map(|s| s.enable_downvotes) + }) + .await??; + if !enable_downvotes { + return Ok(HttpResponse::Ok().finish()); + } + let dislike = Dislike::from_any_base(activity)?.context(location_info!())?; match dislike.object().as_single_kind_str() { Some("Page") => receive_dislike_post(dislike, context).await,