mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
On registration set show_nsfw based on site.content_warning (#4616)
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
This commit is contained in:
parent
522f974e30
commit
cfdc732d3a
@ -40,7 +40,7 @@ pub struct Register {
|
|||||||
pub username: String,
|
pub username: String,
|
||||||
pub password: Sensitive<String>,
|
pub password: Sensitive<String>,
|
||||||
pub password_verify: Sensitive<String>,
|
pub password_verify: Sensitive<String>,
|
||||||
pub show_nsfw: bool,
|
pub show_nsfw: Option<bool>,
|
||||||
/// email is mandatory if email verification is enabled on the server
|
/// email is mandatory if email verification is enabled on the server
|
||||||
pub email: Option<Sensitive<String>>,
|
pub email: Option<Sensitive<String>>,
|
||||||
/// The UUID of the captcha item.
|
/// The UUID of the captcha item.
|
||||||
|
@ -142,12 +142,17 @@ pub async fn register(
|
|||||||
.map(|lang_str| lang_str.split('-').next().unwrap_or_default().to_string())
|
.map(|lang_str| lang_str.split('-').next().unwrap_or_default().to_string())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
// Show nsfw content if param is true, or if content_warning exists
|
||||||
|
let show_nsfw = data
|
||||||
|
.show_nsfw
|
||||||
|
.unwrap_or(site_view.site.content_warning.is_some());
|
||||||
|
|
||||||
// Create the local user
|
// Create the local user
|
||||||
let local_user_form = LocalUserInsertForm::builder()
|
let local_user_form = LocalUserInsertForm::builder()
|
||||||
.person_id(inserted_person.id)
|
.person_id(inserted_person.id)
|
||||||
.email(data.email.as_deref().map(str::to_lowercase))
|
.email(data.email.as_deref().map(str::to_lowercase))
|
||||||
.password_encrypted(data.password.to_string())
|
.password_encrypted(data.password.to_string())
|
||||||
.show_nsfw(Some(data.show_nsfw))
|
.show_nsfw(Some(show_nsfw))
|
||||||
.accepted_application(accepted_application)
|
.accepted_application(accepted_application)
|
||||||
.default_listing_type(Some(local_site.default_post_listing_type))
|
.default_listing_type(Some(local_site.default_post_listing_type))
|
||||||
.post_listing_mode(Some(local_site.default_post_listing_mode))
|
.post_listing_mode(Some(local_site.default_post_listing_mode))
|
||||||
|
Loading…
Reference in New Issue
Block a user