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>> {
is_admin(&local_user_view)?;
let allowlist = Instance::allowlist(&mut context.pool()).await?;
if !allowlist.is_empty() {
return Err(
LemmyErrorType::Unknown("Using allowlist requires that blocklist be empty".to_string())
.into(),
);
let blocklist = Instance::blocklist(&mut context.pool()).await?;
if !blocklist.is_empty() {
Err(LemmyErrorType::CannotCombineFederationBlocklistAndAllowlist)?;
}
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?;
if !allowlist.is_empty() {
return Err(
LemmyErrorType::Unknown("Using blocklist requires that allowlist be empty".to_string())
.into(),
);
Err(LemmyErrorType::CannotCombineFederationBlocklistAndAllowlist)?;
}
let instance_block_form = AdminBlockInstanceForm {

View file

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