diff --git a/upub/routes/src/activitypub/actor/following.rs b/upub/routes/src/activitypub/actor/following.rs index 96bd89e..3f1deea 100644 --- a/upub/routes/src/activitypub/actor/following.rs +++ b/upub/routes/src/activitypub/actor/following.rs @@ -120,6 +120,5 @@ pub async fn page( &upub::url!(ctx, "/actors/{id}/{follow___}/page"), offset, limit, following.into_iter().map(serde_json::Value::String).collect(), - true ) } diff --git a/upub/routes/src/activitypub/actor/notifications.rs b/upub/routes/src/activitypub/actor/notifications.rs index 1a1f5c0..8d0d215 100644 --- a/upub/routes/src/activitypub/actor/notifications.rs +++ b/upub/routes/src/activitypub/actor/notifications.rs @@ -52,6 +52,6 @@ pub async fn page( .map(|x| x.ap()) .collect(); - crate::builders::collection_page(&upub::url!(ctx, "/actors/{id}/notifications/page"), offset, limit, activities, true) + crate::builders::collection_page(&upub::url!(ctx, "/actors/{id}/notifications/page"), offset, limit, activities) } diff --git a/upub/routes/src/activitypub/object/context.rs b/upub/routes/src/activitypub/object/context.rs index 166a1d7..3cc1751 100644 --- a/upub/routes/src/activitypub/object/context.rs +++ b/upub/routes/src/activitypub/object/context.rs @@ -51,5 +51,5 @@ pub async fn page( .map(|item| item.ap()) .collect(); - crate::builders::collection_page(&id, offset, limit, items, true) + crate::builders::collection_page(&id, offset, limit, items) } diff --git a/upub/routes/src/activitypub/tags.rs b/upub/routes/src/activitypub/tags.rs index 26dbbb5..415bf04 100644 --- a/upub/routes/src/activitypub/tags.rs +++ b/upub/routes/src/activitypub/tags.rs @@ -47,7 +47,6 @@ pub async fn page( offset, limit, objects, - true, ) } diff --git a/upub/routes/src/builders.rs b/upub/routes/src/builders.rs index 5931f38..51be453 100644 --- a/upub/routes/src/builders.rs +++ b/upub/routes/src/builders.rs @@ -21,9 +21,7 @@ pub async fn paginate_feed( .add(filter); // by default we want replies because servers don't know about our api and want everything - let replies = page.replies.unwrap_or(true); - - if !replies { + if !page.replies.unwrap_or(true) { conditions = conditions.add(upub::model::object::Column::InReplyTo.is_null()); } @@ -54,19 +52,18 @@ pub async fn paginate_feed( .map(|item| item.ap()) .collect(); - collection_page(&id, offset, limit, items, replies) + collection_page(&id, offset, limit, items) } -pub fn collection_page(id: &str, offset: u64, limit: u64, items: Vec, replies: bool) -> crate::ApiResult> { - let replies = if replies { "" } else { "&replies=false" }; +pub fn collection_page(id: &str, offset: u64, limit: u64, items: Vec) -> crate::ApiResult> { let next = if items.len() < limit as usize { apb::Node::Empty } else { - apb::Node::link(format!("{id}?offset={}{replies}", offset+limit)) + apb::Node::link(format!("{id}?offset={}", offset+limit)) }; Ok(JsonLD( apb::new() - .set_id(Some(&format!("{id}?offset={offset}{replies}"))) + .set_id(Some(&format!("{id}?offset={offset}"))) .set_collection_type(Some(apb::CollectionType::OrderedCollectionPage)) .set_part_of(apb::Node::link(id.replace("/page", ""))) .set_ordered_items(apb::Node::array(items))