PostOrComment,
};
use activitystreams_kinds::public;
+use anyhow::anyhow;
use lemmy_api_common::blocking;
use lemmy_apub_lib::{
data::Data,
};
use lemmy_db_schema::{
newtypes::CommunityId,
- source::{community::Community, post::Post},
+ source::{community::Community, post::Post, site::Site},
traits::Crud,
};
use lemmy_utils::LemmyError;
verify_activity(&self.id, self.actor.inner(), &context.settings())?;
let community = self.get_community(context, request_counter).await?;
verify_person_in_community(&self.actor, &community, context, request_counter).await?;
+ let site = blocking(context.pool(), Site::read_local_site).await??;
+ if self.kind == VoteType::Dislike && !site.enable_downvotes {
+ return Err(anyhow!("Downvotes disabled").into());
+ }
Ok(())
}
pub(crate) unparsed: Unparsed,
}
-#[derive(Clone, Debug, Display, Deserialize, Serialize)]
+#[derive(Clone, Debug, Display, Deserialize, Serialize, PartialEq)]
pub enum VoteType {
Like,
Dislike,