Add UI setting for collapsing bot comments. Fixes #3838 (#4098)

* Add UI setting for collapsing bot comments. Fixes #3838

* Fixing clippy check.
This commit is contained in:
Dessalines 2023-11-06 16:09:12 -05:00 committed by GitHub
parent b9b65c9c18
commit 97a4fb9a72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 0 deletions

View File

@ -119,6 +119,7 @@ pub async fn save_user_settings(
post_listing_mode: data.post_listing_mode,
enable_keyboard_navigation: data.enable_keyboard_navigation,
enable_animated_images: data.enable_animated_images,
collapse_bot_comments: data.collapse_bot_comments,
..Default::default()
};

View File

@ -129,6 +129,8 @@ pub struct SaveUserSettings {
pub enable_keyboard_navigation: Option<bool>,
/// Whether user avatars or inline images in the UI that are gifs should be allowed to play or should be paused
pub enable_animated_images: Option<bool>,
/// Whether to auto-collapse bot comments.
pub collapse_bot_comments: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]

View File

@ -447,6 +447,7 @@ diesel::table! {
totp_2fa_enabled -> Bool,
enable_keyboard_navigation -> Bool,
enable_animated_images -> Bool,
collapse_bot_comments -> Bool,
}
}

View File

@ -60,6 +60,8 @@ pub struct LocalUser {
pub enable_keyboard_navigation: bool,
/// Whether user avatars and inline images in the UI that are gifs should be allowed to play or should be paused
pub enable_animated_images: bool,
/// Whether to auto-collapse bot comments.
pub collapse_bot_comments: bool,
}
#[derive(Clone, TypedBuilder)]
@ -94,6 +96,7 @@ pub struct LocalUserInsertForm {
pub totp_2fa_enabled: Option<bool>,
pub enable_keyboard_navigation: Option<bool>,
pub enable_animated_images: Option<bool>,
pub collapse_bot_comments: Option<bool>,
}
#[derive(Clone, Default)]
@ -124,4 +127,5 @@ pub struct LocalUserUpdateForm {
pub totp_2fa_enabled: Option<bool>,
pub enable_keyboard_navigation: Option<bool>,
pub enable_animated_images: Option<bool>,
pub collapse_bot_comments: Option<bool>,
}

View File

@ -268,6 +268,7 @@ mod tests {
totp_2fa_enabled: inserted_sara_local_user.totp_2fa_enabled,
enable_keyboard_navigation: inserted_sara_local_user.enable_keyboard_navigation,
enable_animated_images: inserted_sara_local_user.enable_animated_images,
collapse_bot_comments: inserted_sara_local_user.collapse_bot_comments,
},
creator: Person {
id: inserted_sara_person.id,

View File

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

View File

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