From 135131ada693e4019fad72b5feea2bdb7606992c Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Wed, 17 Mar 2021 18:03:34 +0100 Subject: [PATCH] Can set the list of members of a group public --- src/controllers/groups_controller.rs | 3 ++- src/data/group.rs | 1 + src/helpers/groups_helper.rs | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controllers/groups_controller.rs b/src/controllers/groups_controller.rs index ac8359e..eee129d 100644 --- a/src/controllers/groups_controller.rs +++ b/src/controllers/groups_controller.rs @@ -10,7 +10,6 @@ use crate::api_data::group_member_api::GroupMemberAPI; use crate::api_data::res_change_group_logo::ResChangeGroupLogo; use crate::api_data::res_create_group::GroupCreationResult; use crate::constants::{DEFAULT_GROUP_LOGO, PATH_GROUPS_LOGOS}; -use crate::routes::RequestResult; use crate::data::base_request_handler::BaseRequestHandler; use crate::data::group::{Group, GroupAccessLevel, GroupPostsCreationLevel, GroupRegistrationLevel, GroupVisibilityLevel}; use crate::data::group_id::GroupID; @@ -20,6 +19,7 @@ use crate::data::new_group::NewGroup; use crate::data::notification::NotifEventType; use crate::helpers::{groups_helper, notifications_helper, virtual_directory_helper}; use crate::helpers::virtual_directory_helper::VirtualDirType; +use crate::routes::RequestResult; use crate::utils::date_utils::time; /// Create a new group @@ -102,6 +102,7 @@ pub fn set_settings(r: &mut HttpRequestHandler) -> RequestResult { visibility: GroupVisibilityLevel::from_api(&r.post_string("visibility")?), registration_level: GroupRegistrationLevel::from_api(&r.post_string("registration_level")?), posts_creation_level: GroupPostsCreationLevel::from_api(&r.post_string("posts_level")?), + is_members_list_public: r.post_bool("is_members_list_public")?, logo: None, virtual_directory: r.post_checked_virtual_directory_opt("virtual_directory", group_id.id(), VirtualDirType::GROUP)?, time_create: 0, diff --git a/src/data/group.rs b/src/data/group.rs index b91fd6b..b5b1f94 100644 --- a/src/data/group.rs +++ b/src/data/group.rs @@ -119,6 +119,7 @@ pub struct Group { pub visibility: GroupVisibilityLevel, pub registration_level: GroupRegistrationLevel, pub posts_creation_level: GroupPostsCreationLevel, + pub is_members_list_public: bool, pub logo: Option, pub virtual_directory: Option, pub time_create: u64, diff --git a/src/helpers/groups_helper.rs b/src/helpers/groups_helper.rs index 1d43775..9f5e61f 100644 --- a/src/helpers/groups_helper.rs +++ b/src/helpers/groups_helper.rs @@ -384,6 +384,7 @@ pub fn set_settings(g: &Group) -> ResultBoxError { .set_u64("visibility", g.visibility.to_db()) .set_u32("registration_level", g.registration_level.to_db()) .set_u32("posts_level", g.posts_creation_level.to_db()) + .set_legacy_bool("is_members_list_public", g.is_members_list_public) .set_opt_str("virtual_directory", g.virtual_directory.clone()) .set_opt_str("description", g.description.clone()) .set_opt_str("url", g.url.clone()) @@ -521,6 +522,7 @@ fn db_to_group(row: &database::RowResult) -> ResultBoxError { visibility: GroupVisibilityLevel::from_db(row.get_u32("visibility")?), registration_level: GroupRegistrationLevel::from_db(row.get_u32("registration_level")?), posts_creation_level: GroupPostsCreationLevel::from_db(row.get_u32("posts_level")?), + is_members_list_public: row.get_legacy_bool("is_members_list_public")?, logo: row.get_optional_str("path_logo")?, virtual_directory: row.get_optional_str("virtual_directory")?, time_create: row.get_u64("time_create")?,