fix check

This commit is contained in:
Felix Ableitner 2024-11-21 16:25:47 +01:00
parent 1e1ab68b29
commit 34d1d906a1
3 changed files with 5 additions and 10 deletions

View file

@ -22,12 +22,9 @@ pub async fn admin_allow_instance(
) -> LemmyResult<Json<SuccessResponse>> { ) -> LemmyResult<Json<SuccessResponse>> {
is_admin(&local_user_view)?; is_admin(&local_user_view)?;
let allowlist = Instance::allowlist(&mut context.pool()).await?; let blocklist = Instance::blocklist(&mut context.pool()).await?;
if !allowlist.is_empty() { if !blocklist.is_empty() {
return Err( Err(LemmyErrorType::CannotCombineFederationBlocklistAndAllowlist)?;
LemmyErrorType::Unknown("Using allowlist requires that blocklist be empty".to_string())
.into(),
);
} }
let instance_block_form = AdminAllowInstanceForm { let instance_block_form = AdminAllowInstanceForm {

View file

@ -24,10 +24,7 @@ pub async fn admin_block_instance(
let allowlist = Instance::allowlist(&mut context.pool()).await?; let allowlist = Instance::allowlist(&mut context.pool()).await?;
if !allowlist.is_empty() { if !allowlist.is_empty() {
return Err( Err(LemmyErrorType::CannotCombineFederationBlocklistAndAllowlist)?;
LemmyErrorType::Unknown("Using blocklist requires that allowlist be empty".to_string())
.into(),
);
} }
let instance_block_form = AdminBlockInstanceForm { let instance_block_form = AdminBlockInstanceForm {

View file

@ -151,6 +151,7 @@ pub enum LemmyErrorType {
CommunityHasNoFollowers, CommunityHasNoFollowers,
PostScheduleTimeMustBeInFuture, PostScheduleTimeMustBeInFuture,
TooManyScheduledPosts, TooManyScheduledPosts,
CannotCombineFederationBlocklistAndAllowlist,
FederationError { FederationError {
#[cfg_attr(feature = "full", ts(optional))] #[cfg_attr(feature = "full", ts(optional))]
error: Option<FederationError>, error: Option<FederationError>,