Merge pull request 'Specify order for activities query (fixes #1436)' (#169) from outbox-order into main

Reviewed-on: https://yerbamate.ml/LemmyNet/lemmy/pulls/169
This commit is contained in:
dessalines 2021-02-18 21:18:26 +00:00
commit 15d0f54a88
2 changed files with 3 additions and 2 deletions

View file

@ -41,8 +41,8 @@ use log::debug;
use url::Url; use url::Url;
/// The types of ActivityPub objects that can be fetched directly by searching for their ID. /// The types of ActivityPub objects that can be fetched directly by searching for their ID.
#[serde(untagged)]
#[derive(serde::Deserialize, Debug)] #[derive(serde::Deserialize, Debug)]
#[serde(untagged)]
enum SearchAcceptedObjects { enum SearchAcceptedObjects {
Person(Box<PersonExt>), Person(Box<PersonExt>),
Group(Box<GroupExt>), Group(Box<GroupExt>),

View file

@ -110,7 +110,8 @@ impl Activity_ for Activity {
.sql(" AND activity.data -> 'object' ->> 'type' = 'Create'") .sql(" AND activity.data -> 'object' ->> 'type' = 'Create'")
.sql(" AND activity.data -> 'object' -> 'object' ->> 'type' = 'Page'") .sql(" AND activity.data -> 'object' -> 'object' ->> 'type' = 'Page'")
.sql(" AND activity.data ->> 'actor' = ") .sql(" AND activity.data ->> 'actor' = ")
.bind::<Text, _>(community_actor_id), .bind::<Text, _>(community_actor_id)
.sql(" ORDER BY activity.id DESC"),
) )
.limit(20) .limit(20)
.get_results(conn)?; .get_results(conn)?;