source::{
community::{Community, CommunityModerator},
post::Post,
+ site::Site,
user::User_,
},
views::community::community_user_ban_view::CommunityUserBanView,
}
}
+pub(crate) async fn check_downvotes_enabled(score: i16, pool: &DbPool) -> Result<(), LemmyError> {
+ if score == -1 {
+ let site = blocking(pool, move |conn| Site::read_simple(conn)).await??;
+ if !site.enable_downvotes {
+ return Err(APIError::err("downvotes_disabled").into());
+ }
+ }
+ Ok(())
+}
+
/// Returns a list of communities that the user moderates
/// or if a community_id is supplied validates the user is a moderator
/// of that community and returns the community id in a vec