commit 52e8bfe

default  ·  2024-08-29 05:33:42 +0000 UTC
parent 5358136
Added links to pinned and bookmarked posts as if they were lists.

They still not work.
1 files changed,  +40, -18
M html.c
M html.c
+40, -18
 1@@ -2157,29 +2157,51 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
 2 
 3     /* show links to the available lists */
 4     if (user && !read_only) {
 5+        xs_html *lol = xs_html_tag("ul",
 6+            xs_html_attr("class", "snac-list-of-lists"));
 7+        xs_html_add(body, lol);
 8+
 9         xs *lists = list_maint(user, NULL, 0); /* get list of lists */
10 
11-        if (xs_list_len(lists)) {
12-            int ct = 0;
13-            const char *v;
14+        int ct = 0;
15+        const char *v;
16 
17-            xs_html *lol = xs_html_tag("ul",
18-                xs_html_attr("class", "snac-list-of-lists"));
19-            xs_html_add(body, lol);
20+        while (xs_list_next(lists, &v, &ct)) {
21+            const char *lname = xs_list_get(v, 1);
22+            xs *url = xs_fmt("%s/list/%s", user->actor, xs_list_get(v, 0));
23+            xs *ttl = xs_fmt(L("Timeline for list '%s'"), lname);
24 
25-            while (xs_list_next(lists, &v, &ct)) {
26-                const char *lname = xs_list_get(v, 1);
27-                xs *url = xs_fmt("%s/list/%s", user->actor, xs_list_get(v, 0));
28-                xs *ttl = xs_fmt(L("Timeline for list '%s'"), lname);
29+            xs_html_add(lol,
30+                xs_html_tag("li",
31+                    xs_html_tag("a",
32+                        xs_html_attr("href", url),
33+                        xs_html_attr("class", "snac-list-link"),
34+                        xs_html_attr("title", ttl),
35+                        xs_html_text(lname))));
36+        }
37 
38-                xs_html_add(lol,
39-                    xs_html_tag("li",
40-                        xs_html_tag("a",
41-                            xs_html_attr("href", url),
42-                            xs_html_attr("class", "snac-list-link"),
43-                            xs_html_attr("title", ttl),
44-                            xs_html_text(lname))));
45-            }
46+        {
47+            /* show the list of pinned posts */
48+            xs *url = xs_fmt("%s/list/pinned", user->actor);
49+            xs_html_add(lol,
50+                xs_html_tag("li",
51+                    xs_html_tag("a",
52+                        xs_html_attr("href", url),
53+                        xs_html_attr("class", "snac-list-link"),
54+                        xs_html_attr("title", L("Pinned posts")),
55+                        xs_html_text("pinned"))));
56+        }
57+
58+        {
59+            /* show the list of bookmarked posts */
60+            xs *url = xs_fmt("%s/list/bookmarks", user->actor);
61+            xs_html_add(lol,
62+                xs_html_tag("li",
63+                    xs_html_tag("a",
64+                        xs_html_attr("href", url),
65+                        xs_html_attr("class", "snac-list-link"),
66+                        xs_html_attr("title", L("Bookmarked posts")),
67+                        xs_html_text("bookmarks"))));
68         }
69     }
70