mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 06:28:03 +08:00
FIX: wasn't able to update user options anymore
This commit is contained in:
parent
460ed3c8cf
commit
28c54b42c5
|
@ -849,7 +849,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def user_params
|
||||
result = params.permit(
|
||||
permitted = [
|
||||
:name,
|
||||
:email,
|
||||
:password,
|
||||
|
@ -858,11 +858,15 @@ class UsersController < ApplicationController
|
|||
:muted_usernames,
|
||||
:theme_key,
|
||||
:locale
|
||||
).reverse_merge(
|
||||
ip_address: request.remote_ip,
|
||||
registration_ip_address: request.remote_ip,
|
||||
locale: user_locale
|
||||
)
|
||||
] + UserUpdater::OPTION_ATTR
|
||||
|
||||
result = params
|
||||
.permit(permitted)
|
||||
.reverse_merge(
|
||||
ip_address: request.remote_ip,
|
||||
registration_ip_address: request.remote_ip,
|
||||
locale: user_locale
|
||||
)
|
||||
|
||||
if !UsernameCheckerService.is_developer?(result['email']) &&
|
||||
is_api? &&
|
||||
|
|
|
@ -1440,13 +1440,15 @@ describe UsersController do
|
|||
put :update, params: {
|
||||
username: user.username,
|
||||
muted_usernames: "",
|
||||
theme_key: theme.key
|
||||
theme_key: theme.key,
|
||||
email_direct: false
|
||||
}, format: :json
|
||||
|
||||
user.reload
|
||||
|
||||
expect(user.muted_users.pluck(:username).sort).to be_empty
|
||||
expect(user.user_option.theme_key).to eq(theme.key)
|
||||
expect(user.user_option.email_direct).to eq(false)
|
||||
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user