Skip to content

Commit

Permalink
Add infinite scroll user option (#3572)
Browse files Browse the repository at this point in the history
  • Loading branch information
dogeek authored Jul 12, 2023
1 parent c060546 commit 9b5e765
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/api/src/local_user/save_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ impl Perform for SaveUserSettings {
.totp_2fa_secret(totp_2fa_secret)
.totp_2fa_url(totp_2fa_url)
.open_links_in_new_tab(data.open_links_in_new_tab)
.infinite_scroll_enabled(data.infinite_scroll_enabled)
.build();

let local_user_res =
Expand Down
2 changes: 2 additions & 0 deletions crates/api_common/src/person.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ pub struct SaveUserSettings {
pub auth: Sensitive<String>,
/// Open links in a new tab
pub open_links_in_new_tab: Option<bool>,
/// Enable infinite scroll
pub infinite_scroll_enabled: Option<bool>,
}

#[derive(Debug, Serialize, Deserialize, Clone, Default)]
Expand Down
1 change: 1 addition & 0 deletions crates/db_schema/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ diesel::table! {
totp_2fa_secret -> Nullable<Text>,
totp_2fa_url -> Nullable<Text>,
open_links_in_new_tab -> Bool,
infinite_scroll_enabled -> Bool,
}
}

Expand Down
4 changes: 4 additions & 0 deletions crates/db_schema/src/source/local_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ pub struct LocalUser {
pub totp_2fa_url: Option<String>,
/// Open links in a new tab.
pub open_links_in_new_tab: bool,
/// Whether infinite scroll is enabled.
pub infinite_scroll_enabled: bool,
}

#[derive(Clone, TypedBuilder)]
Expand Down Expand Up @@ -81,6 +83,7 @@ pub struct LocalUserInsertForm {
pub totp_2fa_secret: Option<Option<String>>,
pub totp_2fa_url: Option<Option<String>>,
pub open_links_in_new_tab: Option<bool>,
pub infinite_scroll_enabled: Option<bool>,
}

#[derive(Clone, TypedBuilder)]
Expand All @@ -106,4 +109,5 @@ pub struct LocalUserUpdateForm {
pub totp_2fa_secret: Option<Option<String>>,
pub totp_2fa_url: Option<Option<String>>,
pub open_links_in_new_tab: Option<bool>,
pub infinite_scroll_enabled: Option<bool>,
}
1 change: 1 addition & 0 deletions crates/db_views/src/registration_application_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ mod tests {
totp_2fa_url: inserted_sara_local_user.totp_2fa_url,
password_encrypted: inserted_sara_local_user.password_encrypted,
open_links_in_new_tab: inserted_sara_local_user.open_links_in_new_tab,
infinite_scroll_enabled: inserted_sara_local_user.infinite_scroll_enabled,
},
creator: Person {
id: inserted_sara_person.id,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table local_user drop column infinite_scroll_enabled;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table local_user add column infinite_scroll_enabled boolean default false not null;

0 comments on commit 9b5e765

Please sign in to comment.