Add infinite scroll user option (#3572)

This commit is contained in:
Simon Bordeyne 2023-07-12 15:12:01 +02:00 committed by GitHub
parent c060546ffa
commit 9b5e765364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 0 deletions

View File

@ -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 =

View File

@ -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)]

View File

@ -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,
}
}

View File

@ -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)]
@ -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)]
@ -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>,
}

View File

@ -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,

View File

@ -0,0 +1 @@
alter table local_user drop column infinite_scroll_enabled;

View File

@ -0,0 +1 @@
alter table local_user add column infinite_scroll_enabled boolean default false not null;