mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 05:15:04 +00:00
Fixed 'show more' in tag search.
This commit is contained in:
parent
c1502219bb
commit
7787fc7d32
1 changed files with 16 additions and 7 deletions
23
httpd.c
23
httpd.c
|
@ -145,15 +145,24 @@ int server_get_handler(xs_dict *req, const char *q_path,
|
||||||
char *t = NULL;
|
char *t = NULL;
|
||||||
|
|
||||||
if (xs_type(q_vars) == XSTYPE_DICT && (t = xs_dict_get(q_vars, "t"))) {
|
if (xs_type(q_vars) == XSTYPE_DICT && (t = xs_dict_get(q_vars, "t"))) {
|
||||||
/* tag search query */
|
int skip = 0;
|
||||||
int skip = xs_number_get(xs_dict_get(q_vars, "skip"));
|
int show = xs_number_get(xs_dict_get(srv_config, "max_timeline_entries"));
|
||||||
int show = xs_number_get(xs_dict_get(q_vars, "show"));
|
char *v;
|
||||||
|
|
||||||
if (show == 0)
|
if ((v = xs_dict_get(q_vars, "skip")) != NULL)
|
||||||
show = 64;
|
skip = atoi(v);
|
||||||
|
if ((v = xs_dict_get(q_vars, "show")) != NULL)
|
||||||
|
show = atoi(v);
|
||||||
|
|
||||||
xs *tl = tag_search(t, skip, show);
|
xs *tl = tag_search(t, skip, show + 1);
|
||||||
*body = html_timeline(NULL, tl, 0, skip, show, 0);
|
int more = 0;
|
||||||
|
if (xs_list_len(tl) >= show + 1) {
|
||||||
|
/* drop the last one */
|
||||||
|
tl = xs_list_del(tl, -1);
|
||||||
|
more = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*body = html_timeline(NULL, tl, 0, skip, show, more);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) {
|
if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) {
|
||||||
|
|
Loading…
Reference in a new issue