]> Untitled Git - lemmy.git/blob - crates/apub_receive/src/http/inbox_enums.rs
Apub inbox rewrite (#1652)
[lemmy.git] / crates / apub_receive / src / http / inbox_enums.rs
1 use crate::activities::{
2   comment::{create::CreateComment, update::UpdateComment},
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::CreatePost, update::UpdatePost},
13   private_message::{
14     create::CreatePrivateMessage,
15     delete::DeletePrivateMessage,
16     undo_delete::UndoDeletePrivateMessage,
17     update::UpdatePrivateMessage,
18   },
19   removal::{
20     remove::RemovePostCommentCommunityOrMod,
21     undo_remove::UndoRemovePostCommentOrCommunity,
22   },
23   voting::{
24     dislike::DislikePostOrComment,
25     like::LikePostOrComment,
26     undo_dislike::UndoDislikePostOrComment,
27     undo_like::UndoLikePostOrComment,
28   },
29 };
30 use lemmy_apub_lib::{ActivityCommonFields, ActivityHandler};
31 use lemmy_utils::LemmyError;
32 use lemmy_websocket::LemmyContext;
33 use serde::{Deserialize, Serialize};
34
35 #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
36 #[serde(untagged)]
37 pub enum PersonInboxActivities {
38   AcceptFollowCommunity(AcceptFollowCommunity),
39   CreatePrivateMessage(CreatePrivateMessage),
40   UpdatePrivateMessage(UpdatePrivateMessage),
41   DeletePrivateMessage(DeletePrivateMessage),
42   UndoDeletePrivateMessage(UndoDeletePrivateMessage),
43   AnnounceActivity(Box<AnnounceActivity>),
44 }
45
46 #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
47 #[serde(untagged)]
48 pub enum GroupInboxActivities {
49   FollowCommunity(FollowCommunity),
50   UndoFollowCommunity(UndoFollowCommunity),
51   CreateComment(CreateComment),
52   UpdateComment(UpdateComment),
53   CreatePost(CreatePost),
54   UpdatePost(UpdatePost),
55   LikePostOrComment(LikePostOrComment),
56   DislikePostOrComment(DislikePostOrComment),
57   UndoLikePostOrComment(UndoLikePostOrComment),
58   UndoDislikePostOrComment(UndoDislikePostOrComment),
59   DeletePostCommentOrCommunity(DeletePostCommentOrCommunity),
60   UndoDeletePostCommentOrCommunity(UndoDeletePostCommentOrCommunity),
61   RemovePostCommentOrCommunity(RemovePostCommentCommunityOrMod),
62   UndoRemovePostCommentOrCommunity(UndoRemovePostCommentOrCommunity),
63   UpdateCommunity(Box<UpdateCommunity>),
64   BlockUserFromCommunity(BlockUserFromCommunity),
65   UndoBlockUserFromCommunity(UndoBlockUserFromCommunity),
66   AddMod(AddMod),
67 }
68
69 #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
70 #[serde(untagged)]
71 pub enum SharedInboxActivities {
72   // received by group
73   FollowCommunity(FollowCommunity),
74   UndoFollowCommunity(UndoFollowCommunity),
75   CreateComment(CreateComment),
76   UpdateComment(UpdateComment),
77   CreatePost(CreatePost),
78   UpdatePost(UpdatePost),
79   LikePostOrComment(LikePostOrComment),
80   DislikePostOrComment(DislikePostOrComment),
81   UndoDislikePostOrComment(UndoDislikePostOrComment),
82   UndoLikePostOrComment(UndoLikePostOrComment),
83   DeletePostCommentOrCommunity(DeletePostCommentOrCommunity),
84   UndoDeletePostCommentOrCommunity(UndoDeletePostCommentOrCommunity),
85   RemovePostCommentOrCommunity(RemovePostCommentCommunityOrMod),
86   UndoRemovePostCommentOrCommunity(UndoRemovePostCommentOrCommunity),
87   UpdateCommunity(Box<UpdateCommunity>),
88   BlockUserFromCommunity(BlockUserFromCommunity),
89   UndoBlockUserFromCommunity(UndoBlockUserFromCommunity),
90   AddMod(AddMod),
91   // received by person
92   AcceptFollowCommunity(AcceptFollowCommunity),
93   // Note, pm activities need to be at the end, otherwise comments will end up here. We can probably
94   // avoid this problem by replacing createpm.object with our own struct, instead of NoteExt.
95   CreatePrivateMessage(CreatePrivateMessage),
96   UpdatePrivateMessage(UpdatePrivateMessage),
97   DeletePrivateMessage(DeletePrivateMessage),
98   UndoDeletePrivateMessage(UndoDeletePrivateMessage),
99   AnnounceActivity(Box<AnnounceActivity>),
100 }