Browse Source

Added links to the lists in html_timeline().

default 11 months ago
parent
commit
a787c818b2
2 changed files with 26 additions and 1 deletions
  1. 1 1
      data.c
  2. 25 0
      html.c

+ 1 - 1
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);
             }
         }

+ 25 - 0
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")));