add missing api params

lemmynsfw-changes
Felix Ableitner 2024-01-23 13:14:06 +01:00
parent c537cf298a
commit 3d3e46433f
4 changed files with 7 additions and 0 deletions

View File

@ -54,6 +54,8 @@ pub struct CreateCommunity {
/// Whether to restrict posting only to moderators. /// Whether to restrict posting only to moderators.
pub posting_restricted_to_mods: Option<bool>, pub posting_restricted_to_mods: Option<bool>,
pub discussion_languages: Option<Vec<LanguageId>>, pub discussion_languages: Option<Vec<LanguageId>>,
/// Only users who are currently following the community can vote on posts and comments
pub only_followers_can_vote: Option<bool>,
} }
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
@ -147,6 +149,8 @@ pub struct EditCommunity {
/// Whether to restrict posting only to moderators. /// Whether to restrict posting only to moderators.
pub posting_restricted_to_mods: Option<bool>, pub posting_restricted_to_mods: Option<bool>,
pub discussion_languages: Option<Vec<LanguageId>>, pub discussion_languages: Option<Vec<LanguageId>>,
/// Only users who are currently following the community can vote on posts and comments
pub only_followers_can_vote: Option<bool>,
} }
#[skip_serializing_none] #[skip_serializing_none]

View File

@ -93,6 +93,7 @@ pub async fn create_community(
.shared_inbox_url(Some(generate_shared_inbox_url(context.settings())?)) .shared_inbox_url(Some(generate_shared_inbox_url(context.settings())?))
.posting_restricted_to_mods(data.posting_restricted_to_mods) .posting_restricted_to_mods(data.posting_restricted_to_mods)
.instance_id(site_view.site.instance_id) .instance_id(site_view.site.instance_id)
.only_followers_can_vote(data.only_followers_can_vote)
.build(); .build();
let inserted_community = Community::create(&mut context.pool(), &community_form) let inserted_community = Community::create(&mut context.pool(), &community_form)

View File

@ -68,6 +68,7 @@ pub async fn update_community(
nsfw: data.nsfw, nsfw: data.nsfw,
posting_restricted_to_mods: data.posting_restricted_to_mods, posting_restricted_to_mods: data.posting_restricted_to_mods,
updated: Some(Some(naive_now())), updated: Some(Some(naive_now())),
only_followers_can_vote: data.only_followers_can_vote,
..Default::default() ..Default::default()
}; };

View File

@ -66,6 +66,7 @@ pub struct Community {
/// Url where featured posts collection is served over Activitypub /// Url where featured posts collection is served over Activitypub
#[serde(skip)] #[serde(skip)]
pub featured_url: Option<DbUrl>, pub featured_url: Option<DbUrl>,
/// Only users who are currently following the community can vote on posts and comments
pub only_followers_can_vote: bool, pub only_followers_can_vote: bool,
} }