mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-12-25 16:53:37 +00:00
mastoapi: show contact metrics if the user want.
This commit is contained in:
parent
a45a0d68e3
commit
2edce5e0ec
1 changed files with 11 additions and 0 deletions
11
mastoapi.c
11
mastoapi.c
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue