use lemmy_db_schema::{
source::{
local_user::{LocalUser, LocalUserForm},
+ local_user_language::LocalUserLanguage,
person::{Person, PersonForm},
site::Site,
},
let default_listing_type = data.default_listing_type;
let default_sort_type = data.default_sort_type;
let password_encrypted = local_user_view.local_user.password_encrypted;
- let public_key = local_user_view.person.public_key;
+ let public_key = Some(local_user_view.person.public_key);
let person_form = PersonForm {
name: local_user_view.person.name,
.await?
.map_err(|e| LemmyError::from_error_message(e, "user_already_exists"))?;
+ if let Some(discussion_languages) = data.discussion_languages.clone() {
+ // An empty array is a "clear" / set all languages
+ let languages = if discussion_languages.is_empty() {
+ None
+ } else {
+ Some(discussion_languages)
+ };
+
+ blocking(context.pool(), move |conn| {
+ LocalUserLanguage::update_user_languages(conn, languages, local_user_id)
+ })
+ .await??;
+ }
+
let local_user_form = LocalUserForm {
person_id: Some(person_id),
email,
theme: data.theme.to_owned(),
default_sort_type,
default_listing_type,
- lang: data.lang.to_owned(),
+ interface_language: data.interface_language.to_owned(),
show_avatars: data.show_avatars,
show_read_posts: data.show_read_posts,
show_new_post_notifs: data.show_new_post_notifs,