verify_person_in_community,
},
fetcher::user_or_community::UserOrCommunity,
- insert_activity,
+ insert_received_activity,
objects::{community::ApubCommunity, person::ApubPerson},
protocol::activities::following::{
accept::AcceptFollow,
use lemmy_api_common::{
community::{BlockCommunity, BlockCommunityResponse},
context::LemmyContext,
- utils::get_local_user_view_from_jwt,
+ utils::local_user_view_from_jwt,
};
use lemmy_db_schema::{
source::{
person_id: actor.id,
pending: true,
};
- CommunityFollower::follow(context.pool(), &community_follower_form)
+ CommunityFollower::follow(&mut context.pool(), &community_follower_form)
.await
.ok();
#[tracing::instrument(skip_all)]
async fn verify(&self, context: &Data<LemmyContext>) -> Result<(), LemmyError> {
+ insert_received_activity(&self.id, context).await?;
verify_person(&self.actor, context).await?;
let object = self.object.dereference(context).await?;
if let UserOrCommunity::Community(c) = object {
#[tracing::instrument(skip_all)]
async fn receive(self, context: &Data<LemmyContext>) -> Result<(), LemmyError> {
- insert_activity(&self.id, &self, false, true, context).await?;
let actor = self.actor.dereference(context).await?;
let object = self.object.dereference(context).await?;
match object {
follower_id: actor.id,
pending: false,
};
- PersonFollower::follow(context.pool(), &form).await?;
+ PersonFollower::follow(&mut context.pool(), &form).await?;
}
UserOrCommunity::Community(c) => {
let form = CommunityFollowerForm {
person_id: actor.id,
pending: false,
};
- CommunityFollower::follow(context.pool(), &form).await?;
+ CommunityFollower::follow(&mut context.pool(), &form).await?;
}
}
_response: &Self::Response,
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
- let local_user_view =
- get_local_user_view_from_jwt(&request.auth, context.pool(), context.secret()).await?;
- let community = Community::read(context.pool(), request.community_id).await?;
+ let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
+ let community = Community::read(&mut context.pool(), request.community_id).await?;
UndoFollow::send(&local_user_view.person.into(), &community.into(), context).await
}
}