1 use activitypub_federation::kinds::collection::CollectionType;
2 use lemmy_api_common::{context::LemmyContext, utils::generate_followers_url};
3 use lemmy_db_schema::source::community::Community;
4 use lemmy_db_views_actor::structs::CommunityFollowerView;
5 use lemmy_utils::error::LemmyError;
6 use serde::{Deserialize, Serialize};
9 #[derive(Clone, Debug, Deserialize, Serialize)]
10 #[serde(rename_all = "camelCase")]
11 pub(crate) struct GroupFollowers {
13 r#type: CollectionType,
19 pub(crate) async fn new(
21 context: &LemmyContext,
22 ) -> Result<GroupFollowers, LemmyError> {
23 let community_id = community.id;
24 let community_followers =
25 CommunityFollowerView::count_community_followers(&mut context.pool(), community_id).await?;
28 id: generate_followers_url(&community.actor_id)?.into(),
29 r#type: CollectionType::Collection,
30 total_items: community_followers as i32,