mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-26 22:31:20 +00:00
Respect disable downvotes setting when federating
This commit is contained in:
parent
97fc51b0cd
commit
c90c96fbf6
1 changed files with 10 additions and 0 deletions
|
@ -16,6 +16,8 @@ use lemmy_db::{
|
||||||
comment_view::CommentView,
|
comment_view::CommentView,
|
||||||
post::{PostForm, PostLike, PostLikeForm},
|
post::{PostForm, PostLike, PostLikeForm},
|
||||||
post_view::PostView,
|
post_view::PostView,
|
||||||
|
site::Site,
|
||||||
|
Crud,
|
||||||
Likeable,
|
Likeable,
|
||||||
};
|
};
|
||||||
use lemmy_structs::{blocking, comment::CommentResponse, post::PostResponse};
|
use lemmy_structs::{blocking, comment::CommentResponse, post::PostResponse};
|
||||||
|
@ -30,6 +32,14 @@ pub async fn receive_dislike(
|
||||||
activity: AnyBase,
|
activity: AnyBase,
|
||||||
context: &LemmyContext,
|
context: &LemmyContext,
|
||||||
) -> Result<HttpResponse, LemmyError> {
|
) -> Result<HttpResponse, LemmyError> {
|
||||||
|
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!())?;
|
let dislike = Dislike::from_any_base(activity)?.context(location_info!())?;
|
||||||
match dislike.object().as_single_kind_str() {
|
match dislike.object().as_single_kind_str() {
|
||||||
Some("Page") => receive_dislike_post(dislike, context).await,
|
Some("Page") => receive_dislike_post(dislike, context).await,
|
||||||
|
|
Loading…
Reference in a new issue