* Make it possible to update users.preferred_theme to NULL * Make preferred them null when 'Default theme' is selected * Run cargo fmt
This commit is contained in:
parent
506fe9955d
commit
b834d1c282
@ -54,6 +54,7 @@ pub enum Role {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, Clone, Debug, AsChangeset)]
|
#[derive(Queryable, Identifiable, Clone, Debug, AsChangeset)]
|
||||||
|
#[changeset_options(treat_none_as_null = "true")]
|
||||||
pub struct User {
|
pub struct User {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub username: String,
|
pub username: String,
|
||||||
|
@ -399,7 +399,10 @@ pub fn update(
|
|||||||
)
|
)
|
||||||
.0,
|
.0,
|
||||||
);
|
);
|
||||||
user.preferred_theme = form.theme.clone();
|
user.preferred_theme = form
|
||||||
|
.theme
|
||||||
|
.clone()
|
||||||
|
.and_then(|t| if &t == "" { None } else { Some(t) });
|
||||||
user.hide_custom_css = form.hide_custom_css;
|
user.hide_custom_css = form.hide_custom_css;
|
||||||
let _: User = user.save_changes(&*conn).map_err(Error::from)?;
|
let _: User = user.save_changes(&*conn).map_err(Error::from)?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user