fix: feed should specify ordering, context by old
This commit is contained in:
parent
edbf381b31
commit
2bd7682c7e
8 changed files with 20 additions and 10 deletions
|
@ -18,8 +18,6 @@ impl Query {
|
|||
.add(model::activity::Column::Id.is_not_null())
|
||||
.add(model::object::Column::Id.is_not_null())
|
||||
)
|
||||
.order_by(model::addressing::Column::Published, Order::Desc)
|
||||
.order_by(model::activity::Column::Internal, Order::Desc)
|
||||
.select_only();
|
||||
|
||||
for col in model::activity::Column::iter() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use axum::{http::StatusCode, extract::{Path, Query, State}, Json};
|
||||
use sea_orm::{ColumnTrait, Condition, QueryFilter, QuerySelect};
|
||||
use sea_orm::{ColumnTrait, Condition, QueryFilter, QueryOrder, QuerySelect};
|
||||
|
||||
use upub::{selector::{RichActivity, RichFillable}, Context};
|
||||
|
||||
|
@ -45,6 +45,8 @@ pub async fn page(
|
|||
.filter(filter)
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
.order_by_desc(upub::model::addressing::Column::Published)
|
||||
.order_by_desc(upub::model::activity::Column::Internal)
|
||||
.into_model::<RichActivity>()
|
||||
.all(ctx.db())
|
||||
.await?
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use axum::{extract::{Path, Query, State}, http::StatusCode, Json};
|
||||
use sea_orm::{ActiveValue::{NotSet, Set}, ColumnTrait, Condition, EntityTrait, QueryFilter, QuerySelect};
|
||||
use sea_orm::{ActiveValue::{NotSet, Set}, ColumnTrait, Condition, EntityTrait, QueryFilter, QueryOrder, QuerySelect};
|
||||
|
||||
use upub::{model, selector::{RichActivity, RichFillable}, Context};
|
||||
|
||||
|
@ -32,9 +32,10 @@ pub async fn page(
|
|||
// by default we want replies because servers don't know about our api and need to see everything
|
||||
let items = upub::Query::feed(auth.my_id(), page.replies.unwrap_or(true))
|
||||
.filter(filter)
|
||||
// TODO also limit to only local activities
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
.order_by_desc(upub::model::addressing::Column::Published)
|
||||
.order_by_desc(upub::model::activity::Column::Internal)
|
||||
.into_model::<RichActivity>()
|
||||
.all(ctx.db())
|
||||
.await?
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use apb::{LD, ActorMut, BaseMut, ObjectMut, PublicKeyMut};
|
||||
use axum::{extract::{Path, Query, State}, http::HeaderMap, response::{IntoResponse, Redirect, Response}};
|
||||
use reqwest::Method;
|
||||
use sea_orm::{ColumnTrait, Condition, QueryFilter, QuerySelect};
|
||||
use sea_orm::{ColumnTrait, Condition, QueryFilter, QueryOrder, QuerySelect};
|
||||
use upub::{selector::{RichFillable, RichObject}, traits::{Cloaker, Fetcher}, Context};
|
||||
|
||||
use crate::{builders::JsonLD, ApiError, AuthIdentity};
|
||||
|
@ -69,6 +69,8 @@ pub async fn search(
|
|||
.filter(filter)
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
.order_by_desc(upub::model::addressing::Column::Published)
|
||||
.order_by_desc(upub::model::activity::Column::Internal)
|
||||
.into_model::<RichObject>()
|
||||
.all(ctx.db())
|
||||
.await?
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use apb::{Activity, ActivityType, Base};
|
||||
use axum::{extract::{Query, State}, http::StatusCode, Json};
|
||||
use sea_orm::{sea_query::IntoCondition, ActiveValue::{NotSet, Set}, ColumnTrait, EntityTrait, QueryFilter, QuerySelect};
|
||||
use sea_orm::{sea_query::IntoCondition, ActiveValue::{NotSet, Set}, ColumnTrait, EntityTrait, QueryFilter, QueryOrder, QuerySelect};
|
||||
use upub::{model::job::JobType, selector::{RichActivity, RichFillable}, Context};
|
||||
|
||||
use crate::{AuthIdentity, Identity, builders::JsonLD};
|
||||
|
@ -25,6 +25,8 @@ pub async fn page(
|
|||
.filter(filter)
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
.order_by_desc(upub::model::addressing::Column::Published)
|
||||
.order_by_desc(upub::model::activity::Column::Internal)
|
||||
.into_model::<RichActivity>()
|
||||
.all(ctx.db())
|
||||
.await?
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use axum::extract::{Path, Query, State};
|
||||
use sea_orm::{ColumnTrait, Condition, PaginatorTrait, QueryFilter, QuerySelect};
|
||||
use sea_orm::{ColumnTrait, Condition, PaginatorTrait, QueryFilter, QueryOrder, QuerySelect};
|
||||
use upub::{model, selector::{RichFillable, RichObject}, Context};
|
||||
|
||||
use crate::{activitypub::Pagination, builders::JsonLD, AuthIdentity};
|
||||
|
@ -39,6 +39,8 @@ pub async fn page(
|
|||
.filter(filter)
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
.order_by_asc(upub::model::addressing::Column::Published)
|
||||
.order_by_asc(upub::model::activity::Column::Internal)
|
||||
.into_model::<RichObject>()
|
||||
.all(ctx.db())
|
||||
.await?
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use apb::{BaseMut, CollectionMut, LD};
|
||||
use axum::extract::{Path, Query, State};
|
||||
use sea_orm::{ColumnTrait, Condition, PaginatorTrait, QueryFilter, QuerySelect};
|
||||
use sea_orm::{ColumnTrait, Condition, PaginatorTrait, QueryFilter, QueryOrder, QuerySelect};
|
||||
use upub::{model, selector::{RichFillable, RichObject}, traits::Fetcher, Context};
|
||||
|
||||
use crate::{activitypub::{Pagination, TryFetch}, builders::JsonLD, AuthIdentity};
|
||||
|
@ -55,9 +55,10 @@ pub async fn page(
|
|||
let (limit, offset) = page.pagination();
|
||||
let items = upub::Query::feed(auth.my_id(), page.replies.unwrap_or(true))
|
||||
.filter(filter)
|
||||
// TODO also limit to only local activities
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
.order_by_desc(upub::model::addressing::Column::Published)
|
||||
.order_by_desc(upub::model::activity::Column::Internal)
|
||||
.into_model::<RichObject>()
|
||||
.all(ctx.db())
|
||||
.await?
|
||||
|
|
|
@ -23,6 +23,8 @@ pub async fn page(
|
|||
.filter(filter)
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
.order_by_desc(upub::model::addressing::Column::Published)
|
||||
.order_by_desc(upub::model::activity::Column::Internal)
|
||||
.into_model::<RichActivity>()
|
||||
.all(ctx.db())
|
||||
.await?
|
||||
|
|
Loading…
Reference in a new issue