aboutsummaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-12-04 07:06:50 +0100
committerdefault <nobody@localhost>2024-12-04 07:06:50 +0100
commit93bc87ecb6b8d1f49733be2bddf1a7301092888a (patch)
treedd363650a3b2f55c09c877ca6bfe806aa8bd2d2e /activitypub.c
parenta6e13e40da960e0d456924c213037f0b6da6ed16 (diff)
New user variable show_contact_metrics.
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c
index 59a69ec..773df78 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -2836,6 +2836,8 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path,
*ctype = "application/activity+json";
+ int show_contact_metrics = xs_is_true(xs_dict_get(snac.config, "show_contact_metrics"));
+
if (p_path == NULL) {
/* if there was no component after the user, it's an actor request */
msg = msg_actor(&snac);
@@ -2875,13 +2877,27 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path,
}
else
if (strcmp(p_path, "followers") == 0) {
+ int total = 0;
+
+ if (show_contact_metrics) {
+ xs *l = follower_list(&snac);
+ total = xs_list_len(l);
+ }
+
xs *id = xs_fmt("%s/%s", snac.actor, p_path);
- msg = msg_collection(&snac, id, 0);
+ msg = msg_collection(&snac, id, total);
}
else
if (strcmp(p_path, "following") == 0) {
+ int total = 0;
+
+ if (show_contact_metrics) {
+ xs *l = following_list(&snac);
+ total = xs_list_len(l);
+ }
+
xs *id = xs_fmt("%s/%s", snac.actor, p_path);
- msg = msg_collection(&snac, id, 0);
+ msg = msg_collection(&snac, id, total);
}
else
if (xs_startswith(p_path, "p/")) {