mirror of https://github.com/LemmyNet/lemmy.git
replace auto_expand_images with default_site_post_listing_mode
parent
23384e133b
commit
a4a4693f1a
|
@ -10,6 +10,7 @@ use lemmy_db_schema::{
|
|||
},
|
||||
ListingType,
|
||||
ModlogActionType,
|
||||
PostListingMode,
|
||||
RegistrationMode,
|
||||
SearchType,
|
||||
SortType,
|
||||
|
@ -188,7 +189,7 @@ pub struct CreateSite {
|
|||
pub taglines: Option<Vec<String>>,
|
||||
pub registration_mode: Option<RegistrationMode>,
|
||||
pub content_warning: Option<String>,
|
||||
pub auto_expand_images: Option<bool>,
|
||||
pub default_post_listing_mode: Option<PostListingMode>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
|
@ -270,8 +271,8 @@ pub struct EditSite {
|
|||
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
||||
/// when the site is first opened by a user.
|
||||
pub content_warning: Option<String>,
|
||||
/// Automatically expand images to full size in the website without manual user action
|
||||
pub auto_expand_images: Option<bool>,
|
||||
/// Default value for [LocalUser.post_listing_mode]
|
||||
pub default_post_listing_mode: Option<PostListingMode>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
|
|
|
@ -90,7 +90,7 @@ pub async fn create_site(
|
|||
captcha_enabled: data.captcha_enabled,
|
||||
captcha_difficulty: data.captcha_difficulty.clone(),
|
||||
content_warning: diesel_option_overwrite(data.content_warning.clone()),
|
||||
auto_expand_images: data.auto_expand_images,
|
||||
default_post_listing_mode: data.default_post_listing_mode,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ pub async fn update_site(
|
|||
captcha_difficulty: data.captcha_difficulty.clone(),
|
||||
reports_email_admins: data.reports_email_admins,
|
||||
content_warning: diesel_option_overwrite(data.content_warning.clone()),
|
||||
auto_expand_images: data.auto_expand_images,
|
||||
default_post_listing_mode: data.default_post_listing_mode,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -139,7 +139,9 @@ pub enum RegistrationMode {
|
|||
Open,
|
||||
}
|
||||
|
||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
|
@ -150,6 +152,7 @@ pub enum RegistrationMode {
|
|||
/// A post-view mode that changes how multiple post listings look.
|
||||
pub enum PostListingMode {
|
||||
/// A compact, list-type view.
|
||||
#[default]
|
||||
List,
|
||||
/// A larger card-type view.
|
||||
Card,
|
||||
|
|
|
@ -345,6 +345,7 @@ diesel::table! {
|
|||
use diesel::sql_types::*;
|
||||
use super::sql_types::ListingTypeEnum;
|
||||
use super::sql_types::RegistrationModeEnum;
|
||||
use super::sql_types::PostListingModeEnum;
|
||||
|
||||
local_site (id) {
|
||||
id -> Int4,
|
||||
|
@ -373,7 +374,7 @@ diesel::table! {
|
|||
reports_email_admins -> Bool,
|
||||
federation_signed_fetch -> Bool,
|
||||
content_warning -> Nullable<Text>,
|
||||
auto_expand_images -> Bool,
|
||||
default_post_listing_mode -> PostListingModeEnum,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ use crate::schema::local_site;
|
|||
use crate::{
|
||||
newtypes::{LocalSiteId, SiteId},
|
||||
ListingType,
|
||||
PostListingMode,
|
||||
RegistrationMode,
|
||||
};
|
||||
use chrono::{DateTime, Utc};
|
||||
|
@ -67,8 +68,8 @@ pub struct LocalSite {
|
|||
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
||||
/// when the site is first opened by a user.
|
||||
pub content_warning: Option<String>,
|
||||
/// Automatically expand images to full size in the website without manual user action
|
||||
pub auto_expand_images: bool,
|
||||
/// Default value for [LocalUser.post_listing_mode]
|
||||
pub default_post_listing_mode: PostListingMode,
|
||||
}
|
||||
|
||||
#[derive(Clone, TypedBuilder)]
|
||||
|
@ -99,7 +100,7 @@ pub struct LocalSiteInsertForm {
|
|||
pub reports_email_admins: Option<bool>,
|
||||
pub federation_signed_fetch: Option<bool>,
|
||||
pub content_warning: Option<String>,
|
||||
pub auto_expand_images: Option<bool>,
|
||||
pub default_post_listing_mode: Option<PostListingMode>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
|
@ -128,5 +129,5 @@ pub struct LocalSiteUpdateForm {
|
|||
pub updated: Option<Option<DateTime<Utc>>>,
|
||||
pub federation_signed_fetch: Option<bool>,
|
||||
pub content_warning: Option<Option<String>>,
|
||||
pub auto_expand_images: Option<bool>,
|
||||
pub default_post_listing_mode: Option<PostListingMode>,
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ ALTER TABLE local_site
|
|||
DROP COLUMN content_warning;
|
||||
|
||||
ALTER TABLE local_site
|
||||
DROP COLUMN auto_expand_images;
|
||||
DROP COLUMN default_post_listing_mode;
|
||||
|
||||
ALTER TABLE community
|
||||
DROP COLUMN only_followers_can_vote;
|
||||
|
|
|
@ -2,7 +2,7 @@ ALTER TABLE local_site
|
|||
ADD COLUMN content_warning text;
|
||||
|
||||
ALTER TABLE local_site
|
||||
ADD COLUMN auto_expand_images boolean NOT NULL DEFAULT FALSE;
|
||||
ADD COLUMN default_post_listing_mode post_listing_mode_enum NOT NULL DEFAULT 'List';
|
||||
|
||||
ALTER TABLE community
|
||||
ADD COLUMN only_followers_can_vote boolean NOT NULL DEFAULT FALSE;
|
||||
|
|
Loading…
Reference in New Issue