]> Untitled Git - lemmy.git/blob - crates/apub/src/http/inbox_enums.rs
03404877739fae50a08b52a1e0405f77043a2811
[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::DeletePostCommentOrCommunity, undo_delete::UndoDeletePostCommentOrCommunity},
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::{
19     remove::RemovePostCommentCommunityOrMod,
20     undo_remove::UndoRemovePostCommentOrCommunity,
21   },
22   voting::{undo_vote::UndoVote, vote::Vote},
23 };
24 use lemmy_apub_lib::{ActivityCommonFields, ActivityHandler};
25 use lemmy_utils::LemmyError;
26 use lemmy_websocket::LemmyContext;
27 use serde::{Deserialize, Serialize};
28
29 #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
30 #[serde(untagged)]
31 pub enum PersonInboxActivities {
32   AcceptFollowCommunity(AcceptFollowCommunity),
33   CreateOrUpdatePrivateMessage(CreateOrUpdatePrivateMessage),
34   DeletePrivateMessage(DeletePrivateMessage),
35   UndoDeletePrivateMessage(UndoDeletePrivateMessage),
36   AnnounceActivity(Box<AnnounceActivity>),
37 }
38
39 #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
40 #[serde(untagged)]
41 pub enum GroupInboxActivities {
42   FollowCommunity(FollowCommunity),
43   UndoFollowCommunity(UndoFollowCommunity),
44   CreateOrUpdateComment(CreateOrUpdateComment),
45   CreateOrUpdatePost(Box<CreateOrUpdatePost>),
46   Vote(Vote),
47   UndoVote(UndoVote),
48   DeletePostCommentOrCommunity(DeletePostCommentOrCommunity),
49   UndoDeletePostCommentOrCommunity(UndoDeletePostCommentOrCommunity),
50   RemovePostCommentOrCommunity(RemovePostCommentCommunityOrMod),
51   UndoRemovePostCommentOrCommunity(UndoRemovePostCommentOrCommunity),
52   UpdateCommunity(Box<UpdateCommunity>),
53   BlockUserFromCommunity(BlockUserFromCommunity),
54   UndoBlockUserFromCommunity(UndoBlockUserFromCommunity),
55   AddMod(AddMod),
56 }
57
58 #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
59 #[serde(untagged)]
60 pub enum SharedInboxActivities {
61   // received by group
62   FollowCommunity(FollowCommunity),
63   UndoFollowCommunity(UndoFollowCommunity),
64   CreateOrUpdateComment(CreateOrUpdateComment),
65   CreateOrUpdatePost(Box<CreateOrUpdatePost>),
66   Vote(Vote),
67   UndoVote(UndoVote),
68   DeletePostCommentOrCommunity(DeletePostCommentOrCommunity),
69   UndoDeletePostCommentOrCommunity(UndoDeletePostCommentOrCommunity),
70   RemovePostCommentOrCommunity(RemovePostCommentCommunityOrMod),
71   UndoRemovePostCommentOrCommunity(UndoRemovePostCommentOrCommunity),
72   UpdateCommunity(Box<UpdateCommunity>),
73   BlockUserFromCommunity(BlockUserFromCommunity),
74   UndoBlockUserFromCommunity(UndoBlockUserFromCommunity),
75   AddMod(AddMod),
76   // received by person
77   AcceptFollowCommunity(AcceptFollowCommunity),
78   // Note, pm activities need to be at the end, otherwise comments will end up here. We can probably
79   // avoid this problem by replacing createpm.object with our own struct, instead of NoteExt.
80   CreateOrUpdatePrivateMessage(CreateOrUpdatePrivateMessage),
81   DeletePrivateMessage(DeletePrivateMessage),
82   UndoDeletePrivateMessage(UndoDeletePrivateMessage),
83   AnnounceActivity(Box<AnnounceActivity>),
84 }