- let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);
- blocking(context.pool(), follow)
- .await?
- .map_err(|e| LemmyError::from_error_message(e, "community_follower_already_exists"))?;
- } else {
- let unfollow =
- move |conn: &'_ _| CommunityFollower::unfollow(conn, &community_follower_form);
- blocking(context.pool(), unfollow)
- .await?
- .map_err(|e| LemmyError::from_error_message(e, "community_follower_already_exists"))?;
- }
- } else if data.follow {
- // Dont actually add to the community followers here, because you need
- // to wait for the accept
- FollowCommunityApub::send(&local_user_view.person.clone().into(), &community, context)
- .await?;
+ CommunityFollower::follow(&mut context.pool(), &community_follower_form)
+ .await
+ .with_lemmy_type(LemmyErrorType::CommunityFollowerAlreadyExists)?;