]> Untitled Git - lemmy.git/blob - crates/apub/src/http/inbox_enums.rs
Rewrite delete activities (#1699)
[lemmy.git] / crates / apub / src / http / inbox_enums.rs
1 use crate::activities::{
2   comment::create_or_update::CreateOrUpdateComment,
3   community::{
4     add_mod::AddMod,
5     announce::AnnounceActivity,
6     block_user::BlockUserFromCommunity,
7     undo_block_user::UndoBlockUserFromCommunity,
8     update::UpdateCommunity,
9   },
10   deletion::{delete::Delete, undo_delete::UndoDelete},
11   following::{accept::AcceptFollowCommunity, follow::FollowCommunity, undo::UndoFollowCommunity},
12   post::create_or_update::CreateOrUpdatePost,
13   private_message::{
14     create_or_update::CreateOrUpdatePrivateMessage,
15     delete::DeletePrivateMessage,
16     undo_delete::UndoDeletePrivateMessage,
17   },
18   removal::{remove::RemoveMod, undo_remove::UndoRemovePostCommentOrCommunity},
19   voting::{undo_vote::UndoVote, vote::Vote},
20 };
21 use lemmy_apub_lib::{ActivityCommonFields, ActivityHandler};
22 use lemmy_utils::LemmyError;
23 use lemmy_websocket::LemmyContext;
24 use serde::{Deserialize, Serialize};
25
26 #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
27 #[serde(untagged)]
28 pub enum PersonInboxActivities {
29   AcceptFollowCommunity(AcceptFollowCommunity),
30   CreateOrUpdatePrivateMessage(CreateOrUpdatePrivateMessage),
31   DeletePrivateMessage(DeletePrivateMessage),
32   UndoDeletePrivateMessage(UndoDeletePrivateMessage),
33   AnnounceActivity(Box<AnnounceActivity>),
34 }
35
36 #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
37 #[serde(untagged)]
38 pub enum GroupInboxActivities {
39   FollowCommunity(FollowCommunity),
40   UndoFollowCommunity(UndoFollowCommunity),
41   CreateOrUpdateComment(CreateOrUpdateComment),
42   CreateOrUpdatePost(Box<CreateOrUpdatePost>),
43   Vote(Vote),
44   UndoVote(UndoVote),
45   DeletePostCommentOrCommunity(Delete),
46   UndoDeletePostCommentOrCommunity(UndoDelete),
47   UndoRemovePostCommentOrCommunity(UndoRemovePostCommentOrCommunity),
48   UpdateCommunity(Box<UpdateCommunity>),
49   BlockUserFromCommunity(BlockUserFromCommunity),
50   UndoBlockUserFromCommunity(UndoBlockUserFromCommunity),
51   AddMod(AddMod),
52   RemoveMod(RemoveMod),
53 }
54
55 #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
56 #[serde(untagged)]
57 pub enum SharedInboxActivities {
58   // received by group
59   FollowCommunity(FollowCommunity),
60   UndoFollowCommunity(UndoFollowCommunity),
61   CreateOrUpdateComment(CreateOrUpdateComment),
62   CreateOrUpdatePost(Box<CreateOrUpdatePost>),
63   Vote(Vote),
64   UndoVote(UndoVote),
65   Delete(Delete),
66   UndoDelete(UndoDelete),
67   UndoRemovePostCommentOrCommunity(UndoRemovePostCommentOrCommunity),
68   UpdateCommunity(Box<UpdateCommunity>),
69   BlockUserFromCommunity(BlockUserFromCommunity),
70   UndoBlockUserFromCommunity(UndoBlockUserFromCommunity),
71   AddMod(AddMod),
72   RemoveMod(RemoveMod),
73   // received by person
74   AcceptFollowCommunity(AcceptFollowCommunity),
75   // Note, pm activities need to be at the end, otherwise comments will end up here. We can probably
76   // avoid this problem by replacing createpm.object with our own struct, instead of NoteExt.
77   CreateOrUpdatePrivateMessage(CreateOrUpdatePrivateMessage),
78   DeletePrivateMessage(DeletePrivateMessage),
79   UndoDeletePrivateMessage(UndoDeletePrivateMessage),
80   AnnounceActivity(Box<AnnounceActivity>),
81 }