1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-29 16:56:28 +00:00

Return forez status with advanced group information

This commit is contained in:
Pierre HUBERT 2021-04-18 14:45:37 +02:00
parent 3da9f26176
commit 82bb23640a

View File

@ -5,6 +5,7 @@ use serde::Serialize;
use crate::api_data::conversation_api::ConversationAPI; use crate::api_data::conversation_api::ConversationAPI;
use crate::api_data::group_api::GroupApi; use crate::api_data::group_api::GroupApi;
use crate::data::config::conf;
use crate::data::error::ResultBoxError; use crate::data::error::ResultBoxError;
use crate::data::group::Group; use crate::data::group::Group;
use crate::data::user::UserID; use crate::data::user::UserID;
@ -23,6 +24,7 @@ pub struct AdvancedGroupApi {
number_likes: u64, number_likes: u64,
is_liking: bool, is_liking: bool,
conversations: Vec<ConversationAPI>, conversations: Vec<ConversationAPI>,
is_forez_group: bool,
} }
impl AdvancedGroupApi { impl AdvancedGroupApi {
@ -44,6 +46,7 @@ impl AdvancedGroupApi {
number_likes: likes_helper::count(g.id.id(), LikeType::GROUP)? as u64, number_likes: likes_helper::count(g.id.id(), LikeType::GROUP)? as u64,
is_liking: likes_helper::is_liking(&user_id.unwrap_or(UserID::invalid()), g.id.id(), LikeType::GROUP)?, is_liking: likes_helper::is_liking(&user_id.unwrap_or(UserID::invalid()), g.id.id(), LikeType::GROUP)?,
conversations: ConversationAPI::for_list(&conversations), conversations: ConversationAPI::for_list(&conversations),
is_forez_group: conf().forez_groups.contains(&g.id),
}) })
} }
} }