summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-11-08 09:43:49 +0100
committerdefault <nobody@localhost>2023-11-08 09:43:49 +0100
commit7787fc7d32083553ab6e9f611e902c487844af83 (patch)
tree0edecdf29c6238e391920ec31838e532f7a72650
parentc1502219bb74daf13c987d599e367476e0c15081 (diff)
Fixed 'show more' in tag search.
-rw-r--r--httpd.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/httpd.c b/httpd.c
index 2a91523..a912df2 100644
--- a/httpd.c
+++ b/httpd.c
@@ -145,15 +145,24 @@ int server_get_handler(xs_dict *req, const char *q_path,
char *t = NULL;
if (xs_type(q_vars) == XSTYPE_DICT && (t = xs_dict_get(q_vars, "t"))) {
- /* tag search query */
- int skip = xs_number_get(xs_dict_get(q_vars, "skip"));
- int show = xs_number_get(xs_dict_get(q_vars, "show"));
-
- if (show == 0)
- show = 64;
+ int skip = 0;
+ int show = xs_number_get(xs_dict_get(srv_config, "max_timeline_entries"));
+ char *v;
+
+ if ((v = xs_dict_get(q_vars, "skip")) != NULL)
+ skip = atoi(v);
+ if ((v = xs_dict_get(q_vars, "show")) != NULL)
+ show = atoi(v);
+
+ xs *tl = tag_search(t, skip, show + 1);
+ int more = 0;
+ if (xs_list_len(tl) >= show + 1) {
+ /* drop the last one */
+ tl = xs_list_del(tl, -1);
+ more = 1;
+ }
- xs *tl = tag_search(t, skip, show);
- *body = html_timeline(NULL, tl, 0, skip, show, 0);
+ *body = html_timeline(NULL, tl, 0, skip, show, more);
}
else
if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) {