1 use crate::generate_followers_url;
2 use activitystreams_kinds::collection::CollectionType;
3 use lemmy_db_schema::source::community::Community;
4 use lemmy_db_views_actor::structs::CommunityFollowerView;
5 use lemmy_utils::error::LemmyError;
6 use lemmy_websocket::LemmyContext;
7 use serde::{Deserialize, Serialize};
10 #[derive(Clone, Debug, Deserialize, Serialize)]
11 #[serde(rename_all = "camelCase")]
12 pub(crate) struct GroupFollowers {
14 r#type: CollectionType,
20 pub(crate) async fn new(
22 context: &LemmyContext,
23 ) -> Result<GroupFollowers, LemmyError> {
24 let community_id = community.id;
25 let community_followers =
26 CommunityFollowerView::for_community(context.pool(), community_id).await?;
29 id: generate_followers_url(&community.actor_id)?.into(),
30 r#type: CollectionType::Collection,
31 total_items: community_followers.len() as i32,