Sfoglia il codice sorgente

Add following and followers (if available) in people entries.

grunfink 3 mesi fa
parent
commit
69e72536b8
1 ha cambiato i file con 14 aggiunte e 0 eliminazioni
  1. 14 0
      html.c

+ 14 - 0
html.c

@@ -3794,6 +3794,20 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c
                 xs_html_add(snac_post, snac_content);
             }
 
+            /* does it have account metrics in the object? */
+            const xs_val *fwing = xs_dict_get(actor, "following_count");
+            const xs_val *fwers = xs_dict_get(actor, "followers_count");
+
+            if (!xs_is_null(fwing) && !xs_is_null(fwers)) {
+                xs *s = xs_fmt(L("%d following, %d followers"),
+                    (int) xs_number_get_l(fwing), (int) xs_number_get_l(fwers));
+
+                xs_html_add(snac_post,
+                    xs_html_tag("div",
+                        xs_html_tag("p",
+                            xs_html_text(s))));
+            }
+
             /* add user metadata */
             xs_html *snac_metadata = xs_html_tag("div",
                 xs_html_attr("class", "snac-metadata"));