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