mirror of https://gitlab.com/bashrc2/epicyon
Pagination on offers collection
parent
0562591ccc
commit
d93e780bef
|
@ -121,13 +121,16 @@ def blocked_timeline_json(actor: str, page_number: int, items_per_page: int,
|
||||||
start_index = (page_number - 1) * items_per_page
|
start_index = (page_number - 1) * items_per_page
|
||||||
if start_index >= len(blocked_list):
|
if start_index >= len(blocked_list):
|
||||||
start_index = 0
|
start_index = 0
|
||||||
|
last_page_number = (len(blocked_list) / items_per_page) + 1
|
||||||
|
|
||||||
result_json = {
|
result_json = {
|
||||||
"@context": [
|
"@context": [
|
||||||
"https://www.w3.org/ns/activitystreams",
|
"https://www.w3.org/ns/activitystreams",
|
||||||
"https://purl.archive.org/socialweb/blocked"
|
"https://purl.archive.org/socialweb/blocked"
|
||||||
],
|
],
|
||||||
"id": actor,
|
"id": actor + '?page=' + str(page_number),
|
||||||
|
"first": actor + '?page=1',
|
||||||
|
"last": actor + '?page=' + str(last_page_number),
|
||||||
"type": "OrderedCollection",
|
"type": "OrderedCollection",
|
||||||
"name": nickname + "'s Blocked Collection",
|
"name": nickname + "'s Blocked Collection",
|
||||||
"orderedItems": []
|
"orderedItems": []
|
||||||
|
|
|
@ -642,7 +642,18 @@ def get_shares_collection(actor: str, page_number: int, items_per_page: int,
|
||||||
"value": shared_item['itemCurrency']
|
"value": shared_item['itemCurrency']
|
||||||
})
|
})
|
||||||
shares_collection.append(offer_item)
|
shares_collection.append(offer_item)
|
||||||
return shares_collection
|
|
||||||
|
result_json = {
|
||||||
|
"@context": [
|
||||||
|
"https://www.w3.org/ns/activitystreams"
|
||||||
|
],
|
||||||
|
"id": actor + '?page=' + str(page_number),
|
||||||
|
"type": "OrderedCollection",
|
||||||
|
"name": nickname + "'s Shared Items",
|
||||||
|
"orderedItems": shares_collection
|
||||||
|
}
|
||||||
|
|
||||||
|
return result_json
|
||||||
|
|
||||||
|
|
||||||
def post_contains_public(post_json_object: {}) -> bool:
|
def post_contains_public(post_json_object: {}) -> bool:
|
||||||
|
|
Loading…
Reference in New Issue