commit 7787fc7
default
·
2023-11-08 08:43:49 +0000 UTC
parent c150221
Fixed 'show more' in tag search.
1 files changed,
+17,
-8
M
httpd.c
M
httpd.c
+17,
-8
1@@ -145,15 +145,24 @@ int server_get_handler(xs_dict *req, const char *q_path,
2 char *t = NULL;
3
4 if (xs_type(q_vars) == XSTYPE_DICT && (t = xs_dict_get(q_vars, "t"))) {
5- /* tag search query */
6- int skip = xs_number_get(xs_dict_get(q_vars, "skip"));
7- int show = xs_number_get(xs_dict_get(q_vars, "show"));
8-
9- if (show == 0)
10- show = 64;
11+ int skip = 0;
12+ int show = xs_number_get(xs_dict_get(srv_config, "max_timeline_entries"));
13+ char *v;
14+
15+ if ((v = xs_dict_get(q_vars, "skip")) != NULL)
16+ skip = atoi(v);
17+ if ((v = xs_dict_get(q_vars, "show")) != NULL)
18+ show = atoi(v);
19+
20+ xs *tl = tag_search(t, skip, show + 1);
21+ int more = 0;
22+ if (xs_list_len(tl) >= show + 1) {
23+ /* drop the last one */
24+ tl = xs_list_del(tl, -1);
25+ more = 1;
26+ }
27
28- xs *tl = tag_search(t, skip, show);
29- *body = html_timeline(NULL, tl, 0, skip, show, 0);
30+ *body = html_timeline(NULL, tl, 0, skip, show, more);
31 }
32 else
33 if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) {