commit 33b0667

grunfink  ·  2026-01-17 04:22:25 +0000 UTC
parents 0f7e970, 1719c1f
Merge pull request 'simple cosmetic counters' (#519) from byte/snac2:counters into master

Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/519
1 files changed,  +13, -7
M html.c
M html.c
+13, -7
 1@@ -3707,13 +3707,19 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
 2 }
 3 
 4 
 5-xs_html *html_people_list(snac *user, xs_list *list, const char *header, const char *t, const char *proxy)
 6+xs_html *html_people_list(snac *user, xs_list *list, const char *header, const char *t, const char *proxy, int do_count)
 7 {
 8     xs_html *snac_posts;
 9+    const char *header_cnt;
10+    if (do_count)
11+        header_cnt = xs_fmt("%s - %d\n", header, xs_list_len(list));
12+    else
13+        header_cnt = xs_fmt("%s\n", header);
14+
15     xs_html *people = xs_html_tag("div",
16         xs_html_tag("h2",
17             xs_html_attr("class", "snac-header"),
18-            xs_html_text(header)),
19+            xs_html_raw(header_cnt)),
20         snac_posts = xs_html_tag("details",
21                 xs_html_attr("open", NULL),
22                 xs_html_tag("summary",
23@@ -3954,12 +3960,12 @@ xs_str *html_people(snac *user)
24 
25     if (xs_list_len(pending) || xs_is_true(xs_dict_get(user->config, "approve_followers"))) {
26         xs_html_add(lists,
27-            html_people_list(user, pending, L("Pending follow confirmations"), "p", proxy));
28+            html_people_list(user, pending, L("Pending follow confirmations"), "p", proxy, 1));
29     }
30 
31     xs_html_add(lists,
32-        html_people_list(user, wing, L("People you follow"), "i", proxy),
33-        html_people_list(user, wers, L("People that follow you"), "e", proxy));
34+        html_people_list(user, wing, L("People you follow"), "i", proxy, 1),
35+        html_people_list(user, wers, L("People that follow you"), "e", proxy, 1));
36 
37     xs_html *html = xs_html_tag("html",
38         html_user_head(user, NULL, NULL),
39@@ -3990,7 +3996,7 @@ xs_str *html_people_one(snac *user, const char *actor, const xs_list *list,
40     xs *foll = xs_list_append(xs_list_new(), actor);
41 
42     xs_html_add(lists,
43-        html_people_list(user, foll, L("Contact's posts"), "p", proxy));
44+        html_people_list(user, foll, L("Contact's posts"), "p", proxy, 0));
45 
46     xs_html_add(body, lists);
47 
48@@ -4644,7 +4650,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
49 
50                             xs *title = xs_fmt(L("Search results for account %s"), q);
51 
52-                            page = html_people_list(&snac, l, title, "wf", NULL);
53+                            page = html_people_list(&snac, l, title, "wf", NULL, 1);
54                         }
55                     }
56