]> Untitled Git - lemmy.git/blobdiff - crates/db_schema/src/impls/local_user.rs
Get rid of Safe Views, use serde_skip (#2767)
[lemmy.git] / crates / db_schema / src / impls / local_user.rs
index eb36fce6f19e0b76f51f199a3d26c0bf7884b0f8..a35096dca1cbcb90ebb4981fcf1ec033659b2921 100644 (file)
@@ -1,6 +1,12 @@
 use crate::{
   newtypes::LocalUserId,
-  schema::local_user::dsl::*,
+  schema::local_user::dsl::{
+    accepted_application,
+    email_verified,
+    local_user,
+    password_encrypted,
+    validator_time,
+  },
   source::{
     actor_language::{LocalUserLanguage, SiteLanguage},
     local_user::{LocalUser, LocalUserInsertForm, LocalUserUpdateForm},
@@ -9,64 +15,9 @@ use crate::{
   utils::{get_conn, naive_now, DbPool},
 };
 use bcrypt::{hash, DEFAULT_COST};
-use diesel::{dsl::*, result::Error, ExpressionMethods, QueryDsl};
+use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
 use diesel_async::RunQueryDsl;
 
-mod safe_settings_type {
-  use crate::{
-    schema::local_user::columns::*,
-    source::local_user::LocalUser,
-    traits::ToSafeSettings,
-  };
-
-  type Columns = (
-    id,
-    person_id,
-    email,
-    show_nsfw,
-    theme,
-    default_sort_type,
-    default_listing_type,
-    interface_language,
-    show_avatars,
-    send_notifications_to_email,
-    validator_time,
-    show_bot_accounts,
-    show_scores,
-    show_read_posts,
-    show_new_post_notifs,
-    email_verified,
-    accepted_application,
-  );
-
-  impl ToSafeSettings for LocalUser {
-    type SafeSettingsColumns = Columns;
-
-    /// Includes everything but the hashed password
-    fn safe_settings_columns_tuple() -> Self::SafeSettingsColumns {
-      (
-        id,
-        person_id,
-        email,
-        show_nsfw,
-        theme,
-        default_sort_type,
-        default_listing_type,
-        interface_language,
-        show_avatars,
-        send_notifications_to_email,
-        validator_time,
-        show_bot_accounts,
-        show_scores,
-        show_read_posts,
-        show_new_post_notifs,
-        email_verified,
-        accepted_application,
-      )
-    }
-  }
-}
-
 impl LocalUser {
   pub async fn update_password(
     pool: &DbPool,