From 223237f7b186b3084fd86254599516b688c05175 Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Thu, 28 Apr 2022 03:35:28 +0000 Subject: [PATCH] Fix lists navigation box FossilOrigin-Name: a61a1612873bf4114f2e486189a76db662043d531bc2afb6e645bbd14aebd55f --- src/timeline.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/timeline.c b/src/timeline.c index 39658d3..26b9042 100644 --- a/src/timeline.c +++ b/src/timeline.c @@ -241,13 +241,13 @@ void tl_list(struct session* ssn, mastodont_t* api, char* list_id) size_t status_count, statuses_html_count; struct mstdnt_status* statuses = NULL; struct mstdnt_storage storage = { 0 }; - char* status_format, *post_box; + char* status_format, *post_box, *navigation_box = NULL, *start_id; char* output = NULL; struct mstdnt_timeline_args args = { - .max_id = NULL, + .max_id = ssn->post.max_id, .since_id = NULL, - .min_id = NULL, + .min_id = ssn->post.min_id, .limit = 20, }; @@ -266,9 +266,19 @@ void tl_list(struct session* ssn, mastodont_t* api, char* list_id) // Create post box post_box = construct_post_box(NULL, "", NULL); - easprintf(&output, "%s%s%s", post_box, - status_format, - data_navigation_html); + if (statuses) + { + // If not set, set it + start_id = ssn->post.start_id ? ssn->post.start_id : statuses[0].id; + navigation_box = construct_navigation_box(start_id, + statuses[0].id, + statuses[status_count-1].id, + NULL); + } + easprintf(&output, "%s%s%s", + post_box, + STR_NULL_EMPTY(status_format), + STR_NULL_EMPTY(navigation_box)); struct base_page b = { .category = BASE_CAT_LISTS, @@ -286,6 +296,7 @@ void tl_list(struct session* ssn, mastodont_t* api, char* list_id) free(status_format); if (post_box) free(post_box); if (output) free(output); + if (navigation_box) free(navigation_box); } void content_tl_home(struct session* ssn, mastodont_t* api, char** data)