add keyboard navigation setting (#3569)

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
Co-authored-by: Dessalines <tyhou13@gmx.com>
This commit is contained in:
Hamzah Mansour 2023-10-10 03:17:27 -07:00 committed by GitHub
parent dc327652a5
commit 6470ea81a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 0 deletions

View File

@ -123,6 +123,8 @@ pub struct SaveUserSettings {
pub open_links_in_new_tab: Option<bool>,
/// Enable infinite scroll
pub infinite_scroll_enabled: Option<bool>,
/// Whether to allow keyboard navigation (for browsing and interacting with posts and comments).
pub enable_keyboard_navigation: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]

View File

@ -442,6 +442,7 @@ diesel::table! {
admin -> Bool,
post_listing_mode -> PostListingModeEnum,
totp_2fa_enabled -> Bool,
enable_keyboard_navigation -> Bool,
}
}

View File

@ -58,6 +58,8 @@ pub struct LocalUser {
pub admin: bool,
pub post_listing_mode: PostListingMode,
pub totp_2fa_enabled: bool,
/// Whether to allow keyboard navigation (for browsing and interacting with posts and comments).
pub enable_keyboard_navigation: bool,
}
#[derive(Clone, TypedBuilder)]
@ -91,6 +93,7 @@ pub struct LocalUserInsertForm {
pub admin: Option<bool>,
pub post_listing_mode: Option<PostListingMode>,
pub totp_2fa_enabled: Option<bool>,
pub enable_keyboard_navigation: Option<bool>,
}
#[derive(Clone, Default)]
@ -120,4 +123,5 @@ pub struct LocalUserUpdateForm {
pub admin: Option<bool>,
pub post_listing_mode: Option<PostListingMode>,
pub totp_2fa_enabled: Option<bool>,
pub enable_keyboard_navigation: Option<bool>,
}

View File

@ -267,6 +267,7 @@ mod tests {
admin: false,
post_listing_mode: inserted_sara_local_user.post_listing_mode,
totp_2fa_enabled: inserted_sara_local_user.totp_2fa_enabled,
enable_keyboard_navigation: inserted_sara_local_user.enable_keyboard_navigation,
},
creator: Person {
id: inserted_sara_person.id,

View File

@ -0,0 +1,3 @@
ALTER TABLE local_user
DROP COLUMN enable_keyboard_navigation;

View File

@ -0,0 +1,3 @@
ALTER TABLE local_user
ADD COLUMN enable_keyboard_navigation boolean DEFAULT FALSE NOT NULL;