mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-09-02 19:23:49 +00:00
parent
0de0ca2f07
commit
df94566f3c
7 changed files with 10 additions and 55 deletions
|
@ -95,7 +95,7 @@ impl ActivityHandler for UndoLockPage {
|
|||
}
|
||||
|
||||
async fn verify(&self, context: &Data<Self::DataType>) -> Result<(), Self::Error> {
|
||||
let community = self.community(context).await?;
|
||||
let community = self.object.community(context).await?;
|
||||
verify_visibility(&self.to, &self.cc, &community)?;
|
||||
verify_person_in_community(&self.actor, &community, context).await?;
|
||||
check_community_deleted_or_removed(&community)?;
|
||||
|
|
|
@ -52,7 +52,7 @@ impl ActivityHandler for UndoVote {
|
|||
}
|
||||
|
||||
async fn verify(&self, context: &Data<LemmyContext>) -> LemmyResult<()> {
|
||||
let community = self.community(context).await?;
|
||||
let community = self.object.community(context).await?;
|
||||
verify_person_in_community(&self.actor, &community, context).await?;
|
||||
verify_urls_match(self.actor.inner(), self.object.actor.inner())?;
|
||||
self.object.verify(context).await?;
|
||||
|
|
|
@ -80,16 +80,16 @@ impl InCommunity for AnnouncableActivities {
|
|||
CreateOrUpdateNoteWrapper(a) => a.community(context).await,
|
||||
CreateOrUpdatePost(a) => a.community(context).await,
|
||||
Vote(a) => a.community(context).await,
|
||||
UndoVote(a) => a.community(context).await,
|
||||
UndoVote(a) => a.object.community(context).await,
|
||||
Delete(a) => a.community(context).await,
|
||||
UndoDelete(a) => a.community(context).await,
|
||||
UndoDelete(a) => a.object.community(context).await,
|
||||
UpdateCommunity(a) => a.community(context).await,
|
||||
BlockUser(a) => a.community(context).await,
|
||||
UndoBlockUser(a) => a.community(context).await,
|
||||
UndoBlockUser(a) => a.object.community(context).await,
|
||||
CollectionAdd(a) => a.community(context).await,
|
||||
CollectionRemove(a) => a.community(context).await,
|
||||
LockPost(a) => a.community(context).await,
|
||||
UndoLockPost(a) => a.community(context).await,
|
||||
UndoLockPost(a) => a.object.community(context).await,
|
||||
Report(a) => a.community(context).await,
|
||||
ResolveReport(a) => a.object.community(context).await,
|
||||
Page(_) => Err(LemmyErrorType::NotFound.into()),
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
use super::block_user::BlockUser;
|
||||
use activitypub_federation::{
|
||||
config::Data,
|
||||
fetch::object_id::ObjectId,
|
||||
kinds::activity::UndoType,
|
||||
protocol::helpers::deserialize_one_or_many,
|
||||
};
|
||||
use lemmy_api_common::context::LemmyContext;
|
||||
use lemmy_apub_objects::{
|
||||
objects::{community::ApubCommunity, person::ApubPerson},
|
||||
utils::protocol::InCommunity,
|
||||
};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use lemmy_apub_objects::objects::person::ApubPerson;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
use url::Url;
|
||||
|
@ -33,10 +27,3 @@ pub struct UndoBlockUser {
|
|||
/// TODO: send a separate Delete activity instead
|
||||
pub(crate) restore_data: Option<bool>,
|
||||
}
|
||||
|
||||
impl InCommunity for UndoBlockUser {
|
||||
async fn community(&self, context: &Data<LemmyContext>) -> LemmyResult<ApubCommunity> {
|
||||
let community = self.object.community(context).await?;
|
||||
Ok(community)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,10 +59,3 @@ impl InCommunity for LockPage {
|
|||
Ok(community.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl InCommunity for UndoLockPage {
|
||||
async fn community(&self, context: &Data<LemmyContext>) -> LemmyResult<ApubCommunity> {
|
||||
let community = self.object.community(context).await?;
|
||||
Ok(community)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
use super::delete::Delete;
|
||||
use activitypub_federation::{
|
||||
config::Data,
|
||||
fetch::object_id::ObjectId,
|
||||
kinds::activity::UndoType,
|
||||
protocol::helpers::deserialize_one_or_many,
|
||||
};
|
||||
use lemmy_api_common::context::LemmyContext;
|
||||
use lemmy_apub_objects::{
|
||||
objects::{community::ApubCommunity, person::ApubPerson},
|
||||
utils::protocol::InCommunity,
|
||||
};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use lemmy_apub_objects::objects::person::ApubPerson;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
use url::Url;
|
||||
|
@ -31,10 +25,3 @@ pub struct UndoDelete {
|
|||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
pub(crate) cc: Vec<Url>,
|
||||
}
|
||||
|
||||
impl InCommunity for UndoDelete {
|
||||
async fn community(&self, context: &Data<LemmyContext>) -> LemmyResult<ApubCommunity> {
|
||||
let community = self.object.community(context).await?;
|
||||
Ok(community)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
use super::vote::Vote;
|
||||
use activitypub_federation::{config::Data, fetch::object_id::ObjectId, kinds::activity::UndoType};
|
||||
use lemmy_api_common::context::LemmyContext;
|
||||
use lemmy_apub_objects::{
|
||||
objects::{community::ApubCommunity, person::ApubPerson},
|
||||
utils::protocol::InCommunity,
|
||||
};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use activitypub_federation::{fetch::object_id::ObjectId, kinds::activity::UndoType};
|
||||
use lemmy_apub_objects::objects::person::ApubPerson;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use url::Url;
|
||||
|
||||
|
@ -18,10 +13,3 @@ pub struct UndoVote {
|
|||
pub(crate) kind: UndoType,
|
||||
pub(crate) id: Url,
|
||||
}
|
||||
|
||||
impl InCommunity for UndoVote {
|
||||
async fn community(&self, context: &Data<LemmyContext>) -> LemmyResult<ApubCommunity> {
|
||||
let community = self.object.community(context).await?;
|
||||
Ok(community)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue