use crate::{
activities::community::announce::GetCommunity,
objects::community::ApubCommunity,
- protocol::activities::{
- community::{
- add_mod::AddMod,
- announce::AnnounceActivity,
- block_user::BlockUserFromCommunity,
- remove_mod::RemoveMod,
- report::Report,
- undo_block_user::UndoBlockUserFromCommunity,
- update::UpdateCommunity,
+ protocol::{
+ activities::{
+ block::{block_user::BlockUser, undo_block_user::UndoBlockUser},
+ community::{
+ add_mod::AddMod,
+ announce::AnnounceActivity,
+ remove_mod::RemoveMod,
+ report::Report,
+ update::UpdateCommunity,
+ },
+ create_or_update::{comment::CreateOrUpdateComment, post::CreateOrUpdatePost},
+ deletion::{delete::Delete, undo_delete::UndoDelete},
+ following::{
+ accept::AcceptFollowCommunity,
+ follow::FollowCommunity,
+ undo_follow::UndoFollowCommunity,
+ },
+ private_message::{
+ create_or_update::CreateOrUpdatePrivateMessage,
+ delete::DeletePrivateMessage,
+ undo_delete::UndoDeletePrivateMessage,
+ },
+ voting::{undo_vote::UndoVote, vote::Vote},
},
- create_or_update::{comment::CreateOrUpdateComment, post::CreateOrUpdatePost},
- deletion::{delete::Delete, undo_delete::UndoDelete},
- following::{
- accept::AcceptFollowCommunity,
- follow::FollowCommunity,
- undo_follow::UndoFollowCommunity,
- },
- private_message::{
- create_or_update::CreateOrUpdatePrivateMessage,
- delete::DeletePrivateMessage,
- undo_delete::UndoDeletePrivateMessage,
- },
- voting::{undo_vote::UndoVote, vote::Vote},
+ objects::page::Page,
},
};
use lemmy_apub_lib::traits::ActivityHandler;
Delete(Delete),
UndoDelete(UndoDelete),
UpdateCommunity(UpdateCommunity),
- BlockUserFromCommunity(BlockUserFromCommunity),
- UndoBlockUserFromCommunity(UndoBlockUserFromCommunity),
+ BlockUser(BlockUser),
+ UndoBlockUser(UndoBlockUser),
AddMod(AddMod),
RemoveMod(RemoveMod),
+ // For compatibility with Pleroma/Mastodon (send only)
+ Page(Page),
+}
+
+#[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
+#[serde(untagged)]
+#[activity_handler(LemmyContext)]
+pub enum SiteInboxActivities {
+ BlockUser(BlockUser),
+ UndoBlockUser(UndoBlockUser),
}
#[async_trait::async_trait(?Send)]
impl GetCommunity for AnnouncableActivities {
+ #[tracing::instrument(skip(self, context))]
async fn get_community(
&self,
context: &LemmyContext,
Delete(a) => a.get_community(context, request_counter).await?,
UndoDelete(a) => a.get_community(context, request_counter).await?,
UpdateCommunity(a) => a.get_community(context, request_counter).await?,
- BlockUserFromCommunity(a) => a.get_community(context, request_counter).await?,
- UndoBlockUserFromCommunity(a) => a.get_community(context, request_counter).await?,
+ BlockUser(a) => a.get_community(context, request_counter).await?,
+ UndoBlockUser(a) => a.get_community(context, request_counter).await?,
AddMod(a) => a.get_community(context, request_counter).await?,
RemoveMod(a) => a.get_community(context, request_counter).await?,
+ Page(_) => unimplemented!(),
};
Ok(community)
}