+ let c = Comment::read_from_apub_id(conn, object_id);
+ Ok(SearchableObjects::Comment(c?))
+ }
+}
+
+#[async_trait::async_trait(?Send)]
+impl FromApub for SearchableObjects {
+ type ApubType = SearchableApubTypes;
+
+ async fn from_apub(
+ apub: &Self::ApubType,
+ context: &LemmyContext,
+ ed: &Url,
+ rc: &mut i32,
+ ) -> Result<Self, LemmyError> {
+ use SearchableApubTypes as SAT;
+ use SearchableObjects as SO;
+ Ok(match apub {
+ SAT::Group(g) => SO::Community(Community::from_apub(g, context, ed, rc).await?),
+ SAT::Person(p) => SO::Person(Person::from_apub(p, context, ed, rc).await?),
+ SAT::Page(p) => SO::Post(Post::from_apub(p, context, ed, rc).await?),
+ SAT::Note(n) => SO::Comment(Comment::from_apub(n, context, ed, rc).await?),
+ })
+ }
+}
+
+#[async_trait::async_trait(?Send)]
+impl DeletableApubObject for SearchableObjects {
+ async fn delete(self, context: &LemmyContext) -> Result<(), LemmyError> {
+ match self {
+ SearchableObjects::Person(p) => p.delete(context).await,
+ SearchableObjects::Community(c) => c.delete(context).await,
+ SearchableObjects::Post(p) => p.delete(context).await,
+ SearchableObjects::Comment(c) => c.delete(context).await,