-
-
Notifications
You must be signed in to change notification settings - Fork 880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On registration, automatically set content languages from accept-language
header
#4550
Conversation
9ca7c5d
to
074e675
Compare
accept-language
header
df3d7a3
to
9c48bce
Compare
// otherwise, init with all languages (this only happens during tests and | ||
// for first admin user, which is created before site) | ||
LocalUserLanguage::update(pool, vec![], local_user_.id).await?; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added another change here, this isnt necessary anymore and was causing some confusion.
// If its the initial site setup, they are an admin | ||
.admin(Some(!local_site.site_setup)) | ||
.build(); | ||
|
||
let inserted_local_user = LocalUser::create(&mut context.pool(), &local_user_form).await?; | ||
|
||
let all_languages = Language::read_all(&mut context.pool()).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests are failing, which tells me something is wrong with moving this logic from the LocalUser::create
(which is run in the unit tests), and this, which is only run from the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought if a user has all languages enabled, thats stored by having nothing at all in LocalUserLanguage
table. But thats not the case, we actually need to store all 184 language rows. So I had to add the update call back in. To avoid writing new user languages twice (first all languages, then those from accept-languages header), Ive removed the impl Crud for LocalUser and instead implemented create directly, so that languages can be passed in.
No description provided.