fix: use wrapped object since we ask for more cols
This commit is contained in:
parent
5d501a3018
commit
46a2e53da0
2 changed files with 7 additions and 7 deletions
|
@ -4,7 +4,7 @@ use apb::{BaseMut, CollectionMut, ObjectMut};
|
||||||
use axum::extract::{Path, Query, State};
|
use axum::extract::{Path, Query, State};
|
||||||
use sea_orm::{ColumnTrait, QueryFilter};
|
use sea_orm::{ColumnTrait, QueryFilter};
|
||||||
|
|
||||||
use crate::{errors::UpubError, model, server::{auth::AuthIdentity, fetcher::Fetcher, Context}};
|
use crate::{errors::UpubError, model::{self, addressing::WrappedObject}, server::{auth::AuthIdentity, fetcher::Fetcher, Context}};
|
||||||
|
|
||||||
use super::{jsonld::LD, JsonLD, TryFetch};
|
use super::{jsonld::LD, JsonLD, TryFetch};
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ pub async fn view(
|
||||||
let Some(object) = model::addressing::Entity::find_objects()
|
let Some(object) = model::addressing::Entity::find_objects()
|
||||||
.filter(model::object::Column::Id.eq(&oid))
|
.filter(model::object::Column::Id.eq(&oid))
|
||||||
.filter(auth.filter_condition())
|
.filter(auth.filter_condition())
|
||||||
.into_model::<model::object::Model>()
|
.into_model::<WrappedObject>()
|
||||||
.one(ctx.db())
|
.one(ctx.db())
|
||||||
.await?
|
.await?
|
||||||
else {
|
else {
|
||||||
|
@ -38,10 +38,10 @@ pub async fn view(
|
||||||
.set_id(Some(&crate::url!(ctx, "/objects/{id}/replies")))
|
.set_id(Some(&crate::url!(ctx, "/objects/{id}/replies")))
|
||||||
.set_collection_type(Some(apb::CollectionType::OrderedCollection))
|
.set_collection_type(Some(apb::CollectionType::OrderedCollection))
|
||||||
.set_first(apb::Node::link(crate::url!(ctx, "/objects/{id}/replies/page")))
|
.set_first(apb::Node::link(crate::url!(ctx, "/objects/{id}/replies/page")))
|
||||||
.set_total_items(Some(object.comments as u64));
|
.set_total_items(Some(object.object.comments as u64));
|
||||||
|
|
||||||
Ok(JsonLD(
|
Ok(JsonLD(
|
||||||
object.ap()
|
object.object.ap()
|
||||||
.set_replies(apb::Node::object(replies))
|
.set_replies(apb::Node::object(replies))
|
||||||
.ld_context()
|
.ld_context()
|
||||||
))
|
))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use axum::extract::{Path, Query, State};
|
use axum::extract::{Path, Query, State};
|
||||||
use sea_orm::{ColumnTrait, Order, PaginatorTrait, QueryFilter, QueryOrder, QuerySelect};
|
use sea_orm::{ColumnTrait, Order, PaginatorTrait, QueryFilter, QueryOrder, QuerySelect};
|
||||||
|
|
||||||
use crate::{model, routes::activitypub::{jsonld::LD, JsonLD, Pagination}, server::{auth::AuthIdentity, Context}, url};
|
use crate::{model::{self, addressing::WrappedObject}, routes::activitypub::{jsonld::LD, JsonLD, Pagination}, server::{auth::AuthIdentity, Context}, url};
|
||||||
|
|
||||||
pub async fn get(
|
pub async fn get(
|
||||||
State(ctx): State<Context>,
|
State(ctx): State<Context>,
|
||||||
|
@ -45,7 +45,7 @@ pub async fn page(
|
||||||
.order_by(model::addressing::Column::Published, Order::Desc)
|
.order_by(model::addressing::Column::Published, Order::Desc)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.into_model::<model::object::Model>()
|
.into_model::<WrappedObject>()
|
||||||
.all(ctx.db())
|
.all(ctx.db())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ pub async fn page(
|
||||||
offset, limit,
|
offset, limit,
|
||||||
items
|
items
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|x| x.ap())
|
.map(|x| x.object.ap())
|
||||||
.collect()
|
.collect()
|
||||||
).ld_context()
|
).ld_context()
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in a new issue