2023-04-17 19:19:51 +00:00
|
|
|
use lemmy_db_schema::RegistrationMode;
|
2023-01-05 01:42:30 +00:00
|
|
|
use lemmy_utils::error::LemmyError;
|
|
|
|
|
2021-03-25 19:19:40 +00:00
|
|
|
mod create;
|
|
|
|
mod read;
|
|
|
|
mod update;
|
2023-01-05 01:42:30 +00:00
|
|
|
|
|
|
|
pub fn check_application_question(
|
|
|
|
application_question: &Option<Option<String>>,
|
|
|
|
registration_mode: RegistrationMode,
|
|
|
|
) -> Result<(), LemmyError> {
|
|
|
|
if registration_mode == RegistrationMode::RequireApplication
|
|
|
|
&& application_question.as_ref().unwrap_or(&None).is_none()
|
|
|
|
{
|
|
|
|
Err(LemmyError::from_message("application_question_required"))
|
|
|
|
} else {
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|