diff options
| author | 2024-12-04 21:45:49 +0100 | |
|---|---|---|
| committer | 2024-12-04 21:45:49 +0100 | |
| commit | 2edce5e0ec5d098a7b879df20496cd636fa6d192 (patch) | |
| tree | 1b473fdc2d6922034bce83da6d90d4e08c885832 /mastoapi.c | |
| parent | Also show contact metrics in the public page, if the user wants. (diff) | |
| download | penes-snac2-2edce5e0ec5d098a7b879df20496cd636fa6d192.tar.gz penes-snac2-2edce5e0ec5d098a7b879df20496cd636fa6d192.tar.xz penes-snac2-2edce5e0ec5d098a7b879df20496cd636fa6d192.zip | |
mastoapi: show contact metrics if the user want.
Diffstat (limited to 'mastoapi.c')
| -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) | |||
| 663 | if (user_open(&user, prefu)) { | 663 | if (user_open(&user, prefu)) { |
| 664 | val_links = user.links; | 664 | val_links = user.links; |
| 665 | metadata = xs_dict_get_def(user.config, "metadata", xs_stock(XSTYPE_DICT)); | 665 | metadata = xs_dict_get_def(user.config, "metadata", xs_stock(XSTYPE_DICT)); |
| 666 | |||
| 667 | /* does this user want to publish their contact metrics? */ | ||
| 668 | if (xs_is_true(xs_dict_get(user.config, "show_contact_metrics"))) { | ||
| 669 | xs *fwing = following_list(&user); | ||
| 670 | xs *fwers = follower_list(&user); | ||
| 671 | xs *ni = xs_number_new(xs_list_len(fwing)); | ||
| 672 | xs *ne = xs_number_new(xs_list_len(fwers)); | ||
| 673 | |||
| 674 | acct = xs_dict_append(acct, "followers_count", ne); | ||
| 675 | acct = xs_dict_append(acct, "following_count", ni); | ||
| 676 | } | ||
| 666 | } | 677 | } |
| 667 | } | 678 | } |
| 668 | 679 | ||