diff --git a/crates/api_common/src/community.rs b/crates/api_common/src/community.rs index 1f4a94636..ed86a4acb 100644 --- a/crates/api_common/src/community.rs +++ b/crates/api_common/src/community.rs @@ -54,6 +54,8 @@ pub struct CreateCommunity { /// Whether to restrict posting only to moderators. pub posting_restricted_to_mods: Option, pub discussion_languages: Option>, + /// Only users who are currently following the community can vote on posts and comments + pub only_followers_can_vote: Option, } #[derive(Debug, Serialize, Deserialize, Clone)] @@ -147,6 +149,8 @@ pub struct EditCommunity { /// Whether to restrict posting only to moderators. pub posting_restricted_to_mods: Option, pub discussion_languages: Option>, + /// Only users who are currently following the community can vote on posts and comments + pub only_followers_can_vote: Option, } #[skip_serializing_none] diff --git a/crates/api_crud/src/community/create.rs b/crates/api_crud/src/community/create.rs index a133d593c..d4b8a5e9f 100644 --- a/crates/api_crud/src/community/create.rs +++ b/crates/api_crud/src/community/create.rs @@ -93,6 +93,7 @@ pub async fn create_community( .shared_inbox_url(Some(generate_shared_inbox_url(context.settings())?)) .posting_restricted_to_mods(data.posting_restricted_to_mods) .instance_id(site_view.site.instance_id) + .only_followers_can_vote(data.only_followers_can_vote) .build(); let inserted_community = Community::create(&mut context.pool(), &community_form) diff --git a/crates/api_crud/src/community/update.rs b/crates/api_crud/src/community/update.rs index 40ba1a2a1..466ea0e2b 100644 --- a/crates/api_crud/src/community/update.rs +++ b/crates/api_crud/src/community/update.rs @@ -68,6 +68,7 @@ pub async fn update_community( nsfw: data.nsfw, posting_restricted_to_mods: data.posting_restricted_to_mods, updated: Some(Some(naive_now())), + only_followers_can_vote: data.only_followers_can_vote, ..Default::default() }; diff --git a/crates/db_schema/src/source/community.rs b/crates/db_schema/src/source/community.rs index 26079ce02..ab0da06d8 100644 --- a/crates/db_schema/src/source/community.rs +++ b/crates/db_schema/src/source/community.rs @@ -66,6 +66,7 @@ pub struct Community { /// Url where featured posts collection is served over Activitypub #[serde(skip)] pub featured_url: Option, + /// Only users who are currently following the community can vote on posts and comments pub only_followers_can_vote: bool, }