mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-21 14:17:08 +00:00
Enable animated avatars setting (#4040)
* feat: Add user setting for toggling avatar gif animations * Add forgotten post listing mode option to settings form * Fix compilation error * Fix formatting * Change name of column to be more general purpose * Fix sql format. * Fix comments * Running format. --------- Co-authored-by: Dessalines <tyhou13@gmx.com> Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
parent
56322c75f0
commit
cf1c32d2ab
|
@ -114,6 +114,9 @@ pub async fn save_user_settings(
|
|||
interface_language: data.interface_language.clone(),
|
||||
open_links_in_new_tab: data.open_links_in_new_tab,
|
||||
infinite_scroll_enabled: data.infinite_scroll_enabled,
|
||||
post_listing_mode: data.post_listing_mode,
|
||||
enable_keyboard_navigation: data.enable_keyboard_navigation,
|
||||
enable_animated_images: data.enable_animated_images,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ use lemmy_db_schema::{
|
|||
newtypes::{CommentReplyId, CommunityId, LanguageId, PersonId, PersonMentionId},
|
||||
CommentSortType,
|
||||
ListingType,
|
||||
PostListingMode,
|
||||
SortType,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommentView, PostView};
|
||||
|
@ -123,8 +124,11 @@ pub struct SaveUserSettings {
|
|||
pub open_links_in_new_tab: Option<bool>,
|
||||
/// Enable infinite scroll
|
||||
pub infinite_scroll_enabled: Option<bool>,
|
||||
pub post_listing_mode: Option<PostListingMode>,
|
||||
/// Whether to allow keyboard navigation (for browsing and interacting with posts and comments).
|
||||
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>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||
|
|
|
@ -444,6 +444,7 @@ diesel::table! {
|
|||
post_listing_mode -> PostListingModeEnum,
|
||||
totp_2fa_enabled -> Bool,
|
||||
enable_keyboard_navigation -> Bool,
|
||||
enable_animated_images -> Bool,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,8 @@ pub struct LocalUser {
|
|||
pub totp_2fa_enabled: bool,
|
||||
/// Whether to allow keyboard navigation (for browsing and interacting with posts and comments).
|
||||
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,
|
||||
}
|
||||
|
||||
#[derive(Clone, TypedBuilder)]
|
||||
|
@ -91,6 +93,7 @@ pub struct LocalUserInsertForm {
|
|||
pub post_listing_mode: Option<PostListingMode>,
|
||||
pub totp_2fa_enabled: Option<bool>,
|
||||
pub enable_keyboard_navigation: Option<bool>,
|
||||
pub enable_animated_images: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
|
@ -120,4 +123,5 @@ pub struct LocalUserUpdateForm {
|
|||
pub post_listing_mode: Option<PostListingMode>,
|
||||
pub totp_2fa_enabled: Option<bool>,
|
||||
pub enable_keyboard_navigation: Option<bool>,
|
||||
pub enable_animated_images: Option<bool>,
|
||||
}
|
||||
|
|
|
@ -267,6 +267,7 @@ mod tests {
|
|||
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,
|
||||
enable_animated_images: inserted_sara_local_user.enable_animated_images,
|
||||
},
|
||||
creator: Person {
|
||||
id: inserted_sara_person.id,
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e943f97fe481dc425acdebc8872bf1fdcabaf875
|
||||
Subproject commit d0f3548379e446d2c333e582734bc68f8d684f4d
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE local_user
|
||||
DROP COLUMN enable_animated_images;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE local_user
|
||||
ADD COLUMN enable_animated_images boolean DEFAULT TRUE NOT NULL;
|
||||
|
Loading…
Reference in a new issue