simplify UI preferences change logic

I copied the example of the password field by introducing a setter.
But I forgot: it was only that way because the password field has
the complexity of hashing/salting. For fields where setting is
idempotent, it can be directly exposed.
This commit is contained in:
Scott Lamb
2021-09-01 21:17:44 -07:00
parent c42314edb5
commit 070400095d
2 changed files with 14 additions and 25 deletions

View File

@@ -1042,7 +1042,7 @@ impl Service {
if let Some(update) = r.update {
let mut change = user.change();
if let Some(preferences) = update.preferences {
change.set_preferences(preferences);
change.preferences = preferences;
}
db.apply_user_change(change).map_err(internal_server_err)?;
}