use crate::newtypes::{LocalSiteId, SiteId};
-use serde::{Deserialize, Serialize};
-use typed_builder::TypedBuilder;
-
#[cfg(feature = "full")]
use crate::schema::local_site;
+use serde::{Deserialize, Serialize};
+use typed_builder::TypedBuilder;
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
pub site_id: SiteId,
pub site_setup: bool,
pub enable_downvotes: bool,
- pub open_registration: bool,
pub enable_nsfw: bool,
pub community_creation_admin_only: bool,
pub require_email_verification: bool,
- pub require_application: bool,
pub application_question: Option<String>,
pub private_instance: bool,
pub default_theme: String,
pub actor_name_max_length: i32,
pub federation_enabled: bool,
pub federation_debug: bool,
- pub federation_strict_allowlist: bool,
- pub federation_http_fetch_retry_limit: i32,
pub federation_worker_count: i32,
pub captcha_enabled: bool,
pub captcha_difficulty: String,
+ pub registration_mode: RegistrationMode,
+ pub reports_email_admins: bool,
pub published: chrono::NaiveDateTime,
pub updated: Option<chrono::NaiveDateTime>,
}
pub site_id: SiteId,
pub site_setup: Option<bool>,
pub enable_downvotes: Option<bool>,
- pub open_registration: Option<bool>,
pub enable_nsfw: Option<bool>,
pub community_creation_admin_only: Option<bool>,
pub require_email_verification: Option<bool>,
- pub require_application: Option<bool>,
pub application_question: Option<String>,
pub private_instance: Option<bool>,
pub default_theme: Option<String>,
pub actor_name_max_length: Option<i32>,
pub federation_enabled: Option<bool>,
pub federation_debug: Option<bool>,
- pub federation_strict_allowlist: Option<bool>,
- pub federation_http_fetch_retry_limit: Option<i32>,
pub federation_worker_count: Option<i32>,
pub captcha_enabled: Option<bool>,
pub captcha_difficulty: Option<String>,
+ pub registration_mode: Option<RegistrationMode>,
+ pub reports_email_admins: Option<bool>,
}
#[derive(Clone, TypedBuilder)]
pub struct LocalSiteUpdateForm {
pub site_setup: Option<bool>,
pub enable_downvotes: Option<bool>,
- pub open_registration: Option<bool>,
pub enable_nsfw: Option<bool>,
pub community_creation_admin_only: Option<bool>,
pub require_email_verification: Option<bool>,
- pub require_application: Option<bool>,
pub application_question: Option<Option<String>>,
pub private_instance: Option<bool>,
pub default_theme: Option<String>,
pub actor_name_max_length: Option<i32>,
pub federation_enabled: Option<bool>,
pub federation_debug: Option<bool>,
- pub federation_strict_allowlist: Option<bool>,
- pub federation_http_fetch_retry_limit: Option<i32>,
pub federation_worker_count: Option<i32>,
pub captcha_enabled: Option<bool>,
pub captcha_difficulty: Option<String>,
+ pub registration_mode: Option<RegistrationMode>,
+ pub reports_email_admins: Option<bool>,
pub updated: Option<Option<chrono::NaiveDateTime>>,
}
+
+#[cfg(feature = "full")]
+#[derive(SqlType)]
+#[diesel(postgres_type(name = "registration_mode_enum"))]
+pub struct RegistrationModeType;
+
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[cfg_attr(feature = "full", derive(FromSqlRow, AsExpression))]
+#[cfg_attr(feature = "full", diesel(sql_type = RegistrationModeType))]
+#[serde(rename_all = "lowercase")]
+pub enum RegistrationMode {
+ Closed,
+ RequireApplication,
+ Open,
+}