fix: make sure percentage themes have percentage signs
This commit is contained in:
parent
5531096660
commit
1048498ceb
1 changed files with 11 additions and 1 deletions
|
@ -64,7 +64,7 @@ pub async fn update_user_settings_request(
|
||||||
jar: CookieJar,
|
jar: CookieJar,
|
||||||
Path(id): Path<usize>,
|
Path(id): Path<usize>,
|
||||||
Extension(data): Extension<State>,
|
Extension(data): Extension<State>,
|
||||||
Json(req): Json<UserSettings>,
|
Json(mut req): Json<UserSettings>,
|
||||||
) -> impl IntoResponse {
|
) -> impl IntoResponse {
|
||||||
let data = &(data.read().await).0;
|
let data = &(data.read().await).0;
|
||||||
let user = match get_user_from_token!(jar, data) {
|
let user = match get_user_from_token!(jar, data) {
|
||||||
|
@ -76,6 +76,16 @@ pub async fn update_user_settings_request(
|
||||||
return Json(Error::NotAllowed.into());
|
return Json(Error::NotAllowed.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check percentage themes
|
||||||
|
if !req.theme_sat.is_empty() && !req.theme_sat.ends_with("%") {
|
||||||
|
req.theme_sat = format!("{}%", req.theme_sat)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !req.theme_lit.is_empty() && !req.theme_lit.ends_with("%") {
|
||||||
|
req.theme_lit = format!("{}%", req.theme_lit)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ...
|
||||||
match data.update_user_settings(id, req).await {
|
match data.update_user_settings(id, req).await {
|
||||||
Ok(_) => Json(ApiReturn {
|
Ok(_) => Json(ApiReturn {
|
||||||
ok: true,
|
ok: true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue