diff options
| author | 2023-11-08 09:43:49 +0100 | |
|---|---|---|
| committer | 2023-11-08 09:43:49 +0100 | |
| commit | 7787fc7d32083553ab6e9f611e902c487844af83 (patch) | |
| tree | 0edecdf29c6238e391920ec31838e532f7a72650 /httpd.c | |
| parent | Local tag links now point to the search by tag URL. (diff) | |
| download | penes-snac2-7787fc7d32083553ab6e9f611e902c487844af83.tar.gz penes-snac2-7787fc7d32083553ab6e9f611e902c487844af83.tar.xz penes-snac2-7787fc7d32083553ab6e9f611e902c487844af83.zip | |
Fixed 'show more' in tag search.
Diffstat (limited to 'httpd.c')
| -rw-r--r-- | httpd.c | 25 |
1 files changed, 17 insertions, 8 deletions
| @@ -145,15 +145,24 @@ int server_get_handler(xs_dict *req, const char *q_path, | |||
| 145 | char *t = NULL; | 145 | char *t = NULL; |
| 146 | 146 | ||
| 147 | if (xs_type(q_vars) == XSTYPE_DICT && (t = xs_dict_get(q_vars, "t"))) { | 147 | if (xs_type(q_vars) == XSTYPE_DICT && (t = xs_dict_get(q_vars, "t"))) { |
| 148 | /* tag search query */ | 148 | int skip = 0; |
| 149 | int skip = xs_number_get(xs_dict_get(q_vars, "skip")); | 149 | int show = xs_number_get(xs_dict_get(srv_config, "max_timeline_entries")); |
| 150 | int show = xs_number_get(xs_dict_get(q_vars, "show")); | 150 | char *v; |
| 151 | 151 | ||
| 152 | if (show == 0) | 152 | if ((v = xs_dict_get(q_vars, "skip")) != NULL) |
| 153 | show = 64; | 153 | skip = atoi(v); |
| 154 | if ((v = xs_dict_get(q_vars, "show")) != NULL) | ||
| 155 | show = atoi(v); | ||
| 156 | |||
| 157 | xs *tl = tag_search(t, skip, show + 1); | ||
| 158 | int more = 0; | ||
| 159 | if (xs_list_len(tl) >= show + 1) { | ||
| 160 | /* drop the last one */ | ||
| 161 | tl = xs_list_del(tl, -1); | ||
| 162 | more = 1; | ||
| 163 | } | ||
| 154 | 164 | ||
| 155 | xs *tl = tag_search(t, skip, show); | 165 | *body = html_timeline(NULL, tl, 0, skip, show, more); |
| 156 | *body = html_timeline(NULL, tl, 0, skip, show, 0); | ||
| 157 | } | 166 | } |
| 158 | else | 167 | else |
| 159 | if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) { | 168 | if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) { |