- // Update in local database
- let community_moderator_form = CommunityModeratorForm {
- community_id: data.community_id,
- person_id: data.person_id,
- };
- if data.added {
- CommunityModerator::join(context.pool(), &community_moderator_form)
- .await
- .map_err(|e| LemmyError::from_error_message(e, "community_moderator_already_exists"))?;
- } else {
- CommunityModerator::leave(context.pool(), &community_moderator_form)
- .await
- .map_err(|e| LemmyError::from_error_message(e, "community_moderator_already_exists"))?;
- }
+ // Mod tables
+ let form = ModAddCommunityForm {
+ mod_person_id: local_user_view.person.id,
+ other_person_id: data.person_id,
+ community_id: data.community_id,
+ removed: Some(!data.added),
+ };