From a787c818b2c52b5bf30d13bb8f3490a92dd8bdcb Mon Sep 17 00:00:00 2001 From: default Date: Fri, 24 May 2024 12:12:03 +0200 Subject: [PATCH] Added links to the lists in html_timeline(). --- data.c | 2 +- html.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/data.c b/data.c index 1866d5e..edbc64f 100644 --- a/data.c +++ b/data.c @@ -1832,7 +1832,7 @@ xs_val *list_maint(snac *user, const char *list, int op) fn = xs_replace_i(fn, ".lst", ".idx"); unlink(fn); - fn = xs_append(fn, ".bak"); + fn = xs_str_cat(fn, ".bak"); unlink(fn); } } diff --git a/html.c b/html.c index 11fe4bf..a9b82da 100644 --- a/html.c +++ b/html.c @@ -2066,6 +2066,31 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only, xs_html_text(title))); } + /* show links to the available lists */ + { + xs *lists = list_maint(user, NULL, 0); /* get list of lists */ + + if (xs_list_len(lists)) { + int ct = 0; + const char *v; + + xs_html *lol = xs_html_tag("ul", + xs_html_attr("class", "snac-list-of-lists")); + xs_html_add(body, lol); + + while (xs_list_next(lists, &v, &ct)) { + xs *url = xs_fmt("%s/list/%s", user->actor, xs_list_get(v, 0)); + + xs_html_add(lol, + xs_html_tag("li", + xs_html_tag("a", + xs_html_attr("href", url), + xs_html_attr("class", "snac-list-link"), + xs_html_text(xs_list_get(v, 1))))); + } + } + } + xs_html_add(body, xs_html_tag("a", xs_html_attr("name", "snac-posts")));