From: Dessalines Date: Sat, 26 Dec 2020 03:22:25 +0000 (-0500) Subject: Changing default_sort and listing back to numbers. X-Git-Url: http://these/git/%7B%60/feeds/front/static/%7BpictrsAvatarThumbnail%28this.state.siteRes.site.icon%29%7D?a=commitdiff_plain;h=418eb8025c5e44fa20f183ef37241a1aa89e6611;p=lemmy.git Changing default_sort and listing back to numbers. --- diff --git a/lemmy_api/src/user.rs b/lemmy_api/src/user.rs index 91c3b11a..ceafad8a 100644 --- a/lemmy_api/src/user.rs +++ b/lemmy_api/src/user.rs @@ -414,8 +414,8 @@ impl Perform for SaveUserSettings { None => user.password_encrypted, }; - let default_listing_type = ListingType::from_str(&data.default_listing_type)? as i16; - let default_sort_type = SortType::from_str(&data.default_sort_type)? as i16; + let default_listing_type = data.default_listing_type; + let default_sort_type = data.default_sort_type; let user_form = UserForm { name: user.name, @@ -509,7 +509,7 @@ impl Perform for GetUserDetails { let user_id = user.map(|u| u.id); - let (user_view, user_dangerous) = if let Some(auth_user_id) = user_id { + let (user_view, user_view_dangerous) = if let Some(auth_user_id) = user_id { if user_details_id == auth_user_id { ( None, @@ -591,7 +591,7 @@ impl Perform for GetUserDetails { // Return the jwt Ok(GetUserDetailsResponse { user_view, - user_view_dangerous: user_dangerous, + user_view_dangerous, follows, moderates, comments, diff --git a/lemmy_db_views/Cargo.toml b/lemmy_db_views/Cargo.toml index 1353ddf3..8991b241 100644 --- a/lemmy_db_views/Cargo.toml +++ b/lemmy_db_views/Cargo.toml @@ -7,4 +7,4 @@ edition = "2018" lemmy_db_queries = { path = "../lemmy_db_queries" } lemmy_db_schema = { path = "../lemmy_db_schema" } diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","serde_json"] } -serde = { version = "1.0.118", features = ["derive"] } \ No newline at end of file +serde = { version = "1.0.118", features = ["derive"] } diff --git a/lemmy_structs/src/user.rs b/lemmy_structs/src/user.rs index a3836f11..5964bf60 100644 --- a/lemmy_structs/src/user.rs +++ b/lemmy_structs/src/user.rs @@ -48,8 +48,8 @@ pub struct CaptchaResponse { pub struct SaveUserSettings { pub show_nsfw: bool, pub theme: String, - pub default_sort_type: String, - pub default_listing_type: String, + pub default_sort_type: i16, + pub default_listing_type: i16, pub lang: String, pub avatar: Option, pub banner: Option,