]> Untitled Git - lemmy.git/blob - crates/apub/src/migrations.rs
493518fe30f2e7f97c16ef2ee7a8847456b20785
[lemmy.git] / crates / apub / src / migrations.rs
1 use crate::fetcher::{object_id::ObjectId, post_or_comment::PostOrComment};
2 use serde::{Deserialize, Serialize};
3 use url::Url;
4
5 /// Migrate comment.in_reply_to field from containing post and parent comment ID, to only containing
6 /// the direct parent (whether its a post or comment). This is for compatibility with Pleroma and
7 /// Smithereen.
8 /// [https://github.com/LemmyNet/lemmy/issues/1454]
9 ///
10 /// v0.12: receive both, send old (compatible with v0.11)
11 /// v0.13 receive both, send new (compatible with v0.12+, incompatible with v0.11)
12 /// v0.14: only send and receive new, remove migration (compatible with v0.13+)
13 #[derive(Serialize, Deserialize, Debug, Clone)]
14 #[serde(untagged)]
15 pub enum CommentInReplyToMigration {
16   Old(Vec<Url>),
17   New(ObjectId<PostOrComment>),
18 }
19
20 // Another migration we are doing is to handle all deletions and removals using Delete activity.
21 // This is because Remove is for removing an object from a collection, so using it that way doesn't
22 // really make sense. It is also a problem because we have a RemoveMod activity, which was awkward
23 // to handle together with removing posts etc.
24 //
25 // v0.11: send and receive mod removals as Remove
26 // v0.12: receive removals as Remove, send as Delete (compatible with v0.11)
27 // v0.13: send and receive mod removals as Delete (compatible with v0.12)
28 //
29 // For v0.13, delete [`UndoRemovePostCommentOrCommunity`], and don't handle object deletion in
30 // [`RemoveMod`] handler.