+
+ fn read_community_outbox(
+ conn: &PgConnection,
+ community_actor_id: &Url,
+ ) -> Result<Vec<Value>, Error> {
+ use lemmy_db_schema::schema::activity::dsl::*;
+ let res: Vec<Value> = activity
+ .select(data)
+ .filter(
+ sql("activity.data ->> 'type' = 'Announce'")
+ .sql(" AND activity.data -> 'object' ->> 'type' = 'Create'")
+ .sql(" AND activity.data -> 'object' -> 'object' ->> 'type' = 'Page'")
+ .sql(" AND activity.data ->> 'actor' = ")
+ .bind::<Text, _>(community_actor_id),
+ )
+ .limit(20)
+ .get_results(conn)?;
+ Ok(res)
+ }