mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-16 09:24:00 +00:00
Prevent making an instance private if federation is enabled. (#3074)
* Prevent making an instance private if federation is enabled. * Added case where federation is enabled, check if the alternative setting is changed * Merged the error messages for private instance/federation. --------- Co-authored-by: Wyatt Smith <wys@dropbox.com>
This commit is contained in:
parent
68d814b9b1
commit
744153eee6
1 changed files with 13 additions and 0 deletions
|
@ -76,6 +76,19 @@ impl PerformCrud for EditSite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let enabled_private_instance_with_federation = data.private_instance == Some(true)
|
||||||
|
&& data
|
||||||
|
.federation_enabled
|
||||||
|
.unwrap_or(local_site.federation_enabled);
|
||||||
|
let enabled_federation_with_private_instance = data.federation_enabled == Some(true)
|
||||||
|
&& data.private_instance.unwrap_or(local_site.private_instance);
|
||||||
|
|
||||||
|
if enabled_private_instance_with_federation || enabled_federation_with_private_instance {
|
||||||
|
return Err(LemmyError::from_message(
|
||||||
|
"cant_enable_private_instance_and_federation_together",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(discussion_languages) = data.discussion_languages.clone() {
|
if let Some(discussion_languages) = data.discussion_languages.clone() {
|
||||||
SiteLanguage::update(context.pool(), discussion_languages.clone(), &site).await?;
|
SiteLanguage::update(context.pool(), discussion_languages.clone(), &site).await?;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue