2 objects::community::ApubCommunity,
3 protocol::activities::following::{follow::Follow, undo_follow::UndoFollow},
6 use lemmy_api_common::{
7 community::{CommunityResponse, FollowCommunity},
9 utils::get_local_user_view_from_jwt,
11 use lemmy_db_schema::{source::community::Community, traits::Crud};
12 use lemmy_utils::error::LemmyError;
18 #[async_trait::async_trait(?Send)]
19 impl SendActivity for FollowCommunity {
20 type Response = CommunityResponse;
22 async fn send_activity(
24 _response: &Self::Response,
25 context: &LemmyContext,
26 ) -> Result<(), LemmyError> {
28 get_local_user_view_from_jwt(&request.auth, context.pool(), context.secret()).await?;
29 let person = local_user_view.person.clone().into();
30 let community: ApubCommunity = Community::read(context.pool(), request.community_id)
35 } else if request.follow {
36 Follow::send(&person, &community, context).await
38 UndoFollow::send(&person, &community, context).await