1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 21:39:21 +00:00

Can set the list of members of a group public

This commit is contained in:
Pierre HUBERT 2021-03-17 18:03:34 +01:00
parent ce1d851585
commit 135131ada6
3 changed files with 5 additions and 1 deletions

View File

@ -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_change_group_logo::ResChangeGroupLogo;
use crate::api_data::res_create_group::GroupCreationResult; use crate::api_data::res_create_group::GroupCreationResult;
use crate::constants::{DEFAULT_GROUP_LOGO, PATH_GROUPS_LOGOS}; use crate::constants::{DEFAULT_GROUP_LOGO, PATH_GROUPS_LOGOS};
use crate::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::group::{Group, GroupAccessLevel, GroupPostsCreationLevel, GroupRegistrationLevel, GroupVisibilityLevel}; use crate::data::group::{Group, GroupAccessLevel, GroupPostsCreationLevel, GroupRegistrationLevel, GroupVisibilityLevel};
use crate::data::group_id::GroupID; use crate::data::group_id::GroupID;
@ -20,6 +19,7 @@ use crate::data::new_group::NewGroup;
use crate::data::notification::NotifEventType; use crate::data::notification::NotifEventType;
use crate::helpers::{groups_helper, notifications_helper, virtual_directory_helper}; use crate::helpers::{groups_helper, notifications_helper, virtual_directory_helper};
use crate::helpers::virtual_directory_helper::VirtualDirType; use crate::helpers::virtual_directory_helper::VirtualDirType;
use crate::routes::RequestResult;
use crate::utils::date_utils::time; use crate::utils::date_utils::time;
/// Create a new group /// Create a new group
@ -102,6 +102,7 @@ pub fn set_settings(r: &mut HttpRequestHandler) -> RequestResult {
visibility: GroupVisibilityLevel::from_api(&r.post_string("visibility")?), visibility: GroupVisibilityLevel::from_api(&r.post_string("visibility")?),
registration_level: GroupRegistrationLevel::from_api(&r.post_string("registration_level")?), registration_level: GroupRegistrationLevel::from_api(&r.post_string("registration_level")?),
posts_creation_level: GroupPostsCreationLevel::from_api(&r.post_string("posts_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, logo: None,
virtual_directory: r.post_checked_virtual_directory_opt("virtual_directory", group_id.id(), VirtualDirType::GROUP)?, virtual_directory: r.post_checked_virtual_directory_opt("virtual_directory", group_id.id(), VirtualDirType::GROUP)?,
time_create: 0, time_create: 0,

View File

@ -119,6 +119,7 @@ pub struct Group {
pub visibility: GroupVisibilityLevel, pub visibility: GroupVisibilityLevel,
pub registration_level: GroupRegistrationLevel, pub registration_level: GroupRegistrationLevel,
pub posts_creation_level: GroupPostsCreationLevel, pub posts_creation_level: GroupPostsCreationLevel,
pub is_members_list_public: bool,
pub logo: Option<String>, pub logo: Option<String>,
pub virtual_directory: Option<String>, pub virtual_directory: Option<String>,
pub time_create: u64, pub time_create: u64,

View File

@ -384,6 +384,7 @@ pub fn set_settings(g: &Group) -> ResultBoxError {
.set_u64("visibility", g.visibility.to_db()) .set_u64("visibility", g.visibility.to_db())
.set_u32("registration_level", g.registration_level.to_db()) .set_u32("registration_level", g.registration_level.to_db())
.set_u32("posts_level", g.posts_creation_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("virtual_directory", g.virtual_directory.clone())
.set_opt_str("description", g.description.clone()) .set_opt_str("description", g.description.clone())
.set_opt_str("url", g.url.clone()) .set_opt_str("url", g.url.clone())
@ -521,6 +522,7 @@ fn db_to_group(row: &database::RowResult) -> ResultBoxError<Group> {
visibility: GroupVisibilityLevel::from_db(row.get_u32("visibility")?), visibility: GroupVisibilityLevel::from_db(row.get_u32("visibility")?),
registration_level: GroupRegistrationLevel::from_db(row.get_u32("registration_level")?), registration_level: GroupRegistrationLevel::from_db(row.get_u32("registration_level")?),
posts_creation_level: GroupPostsCreationLevel::from_db(row.get_u32("posts_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")?, logo: row.get_optional_str("path_logo")?,
virtual_directory: row.get_optional_str("virtual_directory")?, virtual_directory: row.get_optional_str("virtual_directory")?,
time_create: row.get_u64("time_create")?, time_create: row.get_u64("time_create")?,