1
0
Fork 0
forked from alemi/upub

feat: don't add next link when done paginating

This commit is contained in:
əlemi 2024-04-23 23:37:57 +02:00
parent e9c765b555
commit 165bf19f8c
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -236,8 +236,14 @@ impl Context {
.set_id(Some(&format!("{id}?offset={offset}")))
.set_collection_type(Some(apb::CollectionType::OrderedCollectionPage))
.set_part_of(apb::Node::link(id.replace("/page", "")))
.set_next(apb::Node::link(format!("{id}?offset={}", offset+limit)))
.set_ordered_items(apb::Node::array(items))
.set_next(
if items.len() < limit as usize {
apb::Node::Empty
} else {
apb::Node::link(format!("{id}?offset={}", offset+limit))
}
)
}
pub async fn dispatch(&self, uid: &str, activity_targets: Vec<String>, aid: &str, oid: Option<&str>) -> crate::Result<()> {