diff options
| author | default <nobody@localhost> | 2024-12-04 21:45:49 +0100 |
|---|---|---|
| committer | default <nobody@localhost> | 2024-12-04 21:45:49 +0100 |
| commit | 2edce5e0ec5d098a7b879df20496cd636fa6d192 (patch) | |
| tree | 1b473fdc2d6922034bce83da6d90d4e08c885832 | |
| parent | a45a0d68e3d8a942a2bf516d5086920dbcb3a862 (diff) | |
mastoapi: show contact metrics if the user want.
| -rw-r--r-- | mastoapi.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -663,6 +663,17 @@ xs_dict *mastoapi_account(snac *logged, const xs_dict *actor) if (user_open(&user, prefu)) { val_links = user.links; metadata = xs_dict_get_def(user.config, "metadata", xs_stock(XSTYPE_DICT)); + + /* does this user want to publish their contact metrics? */ + if (xs_is_true(xs_dict_get(user.config, "show_contact_metrics"))) { + xs *fwing = following_list(&user); + xs *fwers = follower_list(&user); + xs *ni = xs_number_new(xs_list_len(fwing)); + xs *ne = xs_number_new(xs_list_len(fwers)); + + acct = xs_dict_append(acct, "followers_count", ne); + acct = xs_dict_append(acct, "following_count", ni); + } } } |