From a65be776e30b51d0d135b8f81d80d324138fe932 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 24 Sep 2024 08:55:09 -0400 Subject: [PATCH] Remove redundant local_user.auto_expand setting. (#5041) - Fixes #4643 Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com> --- crates/api/src/local_user/save_settings.rs | 1 - crates/api_common/src/person.rs | 2 +- crates/apub/src/api/user_settings_backup.rs | 1 - crates/db_schema/src/schema.rs | 1 - crates/db_schema/src/source/local_user.rs | 4 ---- crates/db_views/src/registration_application_view.rs | 1 - migrations/2024-09-23-133038_remove_auto_expand/down.sql | 3 +++ migrations/2024-09-23-133038_remove_auto_expand/up.sql | 3 +++ 8 files changed, 7 insertions(+), 9 deletions(-) create mode 100644 migrations/2024-09-23-133038_remove_auto_expand/down.sql create mode 100644 migrations/2024-09-23-133038_remove_auto_expand/up.sql diff --git a/crates/api/src/local_user/save_settings.rs b/crates/api/src/local_user/save_settings.rs index 029914545..08820cadd 100644 --- a/crates/api/src/local_user/save_settings.rs +++ b/crates/api/src/local_user/save_settings.rs @@ -130,7 +130,6 @@ pub async fn save_user_settings( send_notifications_to_email: data.send_notifications_to_email, show_nsfw: data.show_nsfw, blur_nsfw: data.blur_nsfw, - auto_expand: data.auto_expand, show_bot_accounts: data.show_bot_accounts, default_post_sort_type, default_comment_sort_type, diff --git a/crates/api_common/src/person.rs b/crates/api_common/src/person.rs index 40e8df4ce..6f1ddfe43 100644 --- a/crates/api_common/src/person.rs +++ b/crates/api_common/src/person.rs @@ -84,8 +84,8 @@ pub struct CaptchaResponse { pub struct SaveUserSettings { /// Show nsfw posts. pub show_nsfw: Option, + /// Blur nsfw posts. pub blur_nsfw: Option, - pub auto_expand: Option, /// Your user's theme. pub theme: Option, /// The default post listing type, usually "local" diff --git a/crates/apub/src/api/user_settings_backup.rs b/crates/apub/src/api/user_settings_backup.rs index 6764f62cb..8acc67da6 100644 --- a/crates/apub/src/api/user_settings_backup.rs +++ b/crates/apub/src/api/user_settings_backup.rs @@ -127,7 +127,6 @@ pub async fn import_settings( show_read_posts: data.settings.as_ref().map(|s| s.show_read_posts), open_links_in_new_tab: data.settings.as_ref().map(|s| s.open_links_in_new_tab), blur_nsfw: data.settings.as_ref().map(|s| s.blur_nsfw), - auto_expand: data.settings.as_ref().map(|s| s.auto_expand), infinite_scroll_enabled: data.settings.as_ref().map(|s| s.infinite_scroll_enabled), post_listing_mode: data.settings.as_ref().map(|s| s.post_listing_mode), ..Default::default() diff --git a/crates/db_schema/src/schema.rs b/crates/db_schema/src/schema.rs index 129b00d8b..ab636c7d7 100644 --- a/crates/db_schema/src/schema.rs +++ b/crates/db_schema/src/schema.rs @@ -459,7 +459,6 @@ diesel::table! { totp_2fa_secret -> Nullable, open_links_in_new_tab -> Bool, blur_nsfw -> Bool, - auto_expand -> Bool, infinite_scroll_enabled -> Bool, admin -> Bool, post_listing_mode -> PostListingModeEnum, diff --git a/crates/db_schema/src/source/local_user.rs b/crates/db_schema/src/source/local_user.rs index 876bfa487..d83fa798c 100644 --- a/crates/db_schema/src/source/local_user.rs +++ b/crates/db_schema/src/source/local_user.rs @@ -49,7 +49,6 @@ pub struct LocalUser { /// Open links in a new tab. pub open_links_in_new_tab: bool, pub blur_nsfw: bool, - pub auto_expand: bool, /// Whether infinite scroll is enabled. pub infinite_scroll_enabled: bool, /// Whether the person is an admin. @@ -104,8 +103,6 @@ pub struct LocalUserInsertForm { #[new(default)] pub blur_nsfw: Option, #[new(default)] - pub auto_expand: Option, - #[new(default)] pub infinite_scroll_enabled: Option, #[new(default)] pub admin: Option, @@ -143,7 +140,6 @@ pub struct LocalUserUpdateForm { pub totp_2fa_secret: Option>, pub open_links_in_new_tab: Option, pub blur_nsfw: Option, - pub auto_expand: Option, pub infinite_scroll_enabled: Option, pub admin: Option, pub post_listing_mode: Option, diff --git a/crates/db_views/src/registration_application_view.rs b/crates/db_views/src/registration_application_view.rs index ba44e927e..94b7e213d 100644 --- a/crates/db_views/src/registration_application_view.rs +++ b/crates/db_views/src/registration_application_view.rs @@ -235,7 +235,6 @@ mod tests { person_id: inserted_sara_local_user.person_id, email: inserted_sara_local_user.email, show_nsfw: inserted_sara_local_user.show_nsfw, - auto_expand: inserted_sara_local_user.auto_expand, blur_nsfw: inserted_sara_local_user.blur_nsfw, theme: inserted_sara_local_user.theme, default_post_sort_type: inserted_sara_local_user.default_post_sort_type, diff --git a/migrations/2024-09-23-133038_remove_auto_expand/down.sql b/migrations/2024-09-23-133038_remove_auto_expand/down.sql new file mode 100644 index 000000000..04e0155d0 --- /dev/null +++ b/migrations/2024-09-23-133038_remove_auto_expand/down.sql @@ -0,0 +1,3 @@ +ALTER TABLE local_user + ADD COLUMN auto_expand boolean NOT NULL DEFAULT FALSE; + diff --git a/migrations/2024-09-23-133038_remove_auto_expand/up.sql b/migrations/2024-09-23-133038_remove_auto_expand/up.sql new file mode 100644 index 000000000..35d706d1b --- /dev/null +++ b/migrations/2024-09-23-133038_remove_auto_expand/up.sql @@ -0,0 +1,3 @@ +ALTER TABLE local_user + DROP COLUMN auto_expand; +