use crate::{
activities::{
- community::{announce::GetCommunity, send_to_community},
+ community::{announce::GetCommunity, send_activity_in_community},
generate_activity_id,
verify_activity,
verify_is_public,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
- fetcher::object_id::ObjectId,
objects::{community::ApubCommunity, person::ApubPerson},
protocol::activities::community::{
block_user::BlockUserFromCommunity,
undo_block_user::UndoBlockUserFromCommunity,
},
};
-use activitystreams::{activity::kind::UndoType, public};
+use activitystreams_kinds::{activity::UndoType, public};
use lemmy_api_common::blocking;
use lemmy_apub_lib::{
data::Data,
+ object_id::ObjectId,
traits::{ActivityHandler, ActorType},
};
use lemmy_db_schema::{
use lemmy_websocket::LemmyContext;
impl UndoBlockUserFromCommunity {
+ #[tracing::instrument(skip_all)]
pub async fn send(
community: &ApubCommunity,
target: &ApubPerson,
actor: &ApubPerson,
context: &LemmyContext,
) -> Result<(), LemmyError> {
- let block = BlockUserFromCommunity::new(community, target, actor, context)?;
+ let block = BlockUserFromCommunity::new(community, target, actor, None, context)?;
let id = generate_activity_id(
UndoType::Undo,
let activity = AnnouncableActivities::UndoBlockUserFromCommunity(undo);
let inboxes = vec![target.shared_inbox_or_inbox_url()];
- send_to_community(activity, &id, actor, community, inboxes, context).await
+ send_activity_in_community(activity, &id, actor, community, inboxes, context).await
}
}
#[async_trait::async_trait(?Send)]
impl ActivityHandler for UndoBlockUserFromCommunity {
type DataType = LemmyContext;
+
+ #[tracing::instrument(skip_all)]
async fn verify(
&self,
context: &Data<LemmyContext>,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
- verify_is_public(&self.to)?;
+ verify_is_public(&self.to, &self.cc)?;
verify_activity(&self.id, self.actor.inner(), &context.settings())?;
let community = self.get_community(context, request_counter).await?;
verify_person_in_community(&self.actor, &community, context, request_counter).await?;
Ok(())
}
+ #[tracing::instrument(skip_all)]
async fn receive(
self,
context: &Data<LemmyContext>,
let blocked_user = self
.object
.object
- .dereference(context, request_counter)
+ .dereference(context, context.client(), request_counter)
.await?;
let community_user_ban_form = CommunityPersonBanForm {
community_id: community.id,
person_id: blocked_user.id,
+ expires: None,
};
blocking(context.pool(), move |conn: &'_ _| {
#[async_trait::async_trait(?Send)]
impl GetCommunity for UndoBlockUserFromCommunity {
+ #[tracing::instrument(skip_all)]
async fn get_community(
&self,
context: &LemmyContext,