summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar green2025-05-12 13:54:06 +0200
committerGravatar green2025-11-14 17:20:54 +0100
commit20f8972a188fd16180aa201313a95423a49f5fc2 (patch)
tree21fe0097f3d592234e15fb26e25b7e6f379219b1 /html.c
parentVersion 2.84 RELEASED. (diff)
downloadsnac2-20f8972a188fd16180aa201313a95423a49f5fc2.tar.gz
snac2-20f8972a188fd16180aa201313a95423a49f5fc2.tar.xz
snac2-20f8972a188fd16180aa201313a95423a49f5fc2.zip
metadata for remote users in people page
Diffstat (limited to '')
-rw-r--r--html.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/html.c b/html.c
index 2146c93..a96d21a 100644
--- a/html.c
+++ b/html.c
@@ -3357,6 +3357,46 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c
3357 xs_html_add(snac_post, snac_content); 3357 xs_html_add(snac_post, snac_content);
3358 } 3358 }
3359 3359
3360 /* add user metadata */
3361 xs_html *snac_metadata = xs_html_tag("div",
3362 xs_html_attr("class", "snac-metadata"));
3363
3364 int count = 0;
3365 const xs_val *v;
3366 const xs_list *attachment = xs_dict_get(actor, "attachment");
3367 xs_list_foreach(attachment, v) {
3368 const char *type = xs_dict_get(v, "type");
3369 const char *name = xs_dict_get(v, "name");
3370 const char *value = xs_dict_get(v, "value");
3371
3372 if (!xs_is_null(type) && !xs_is_null(name) &&
3373 !xs_is_null(value) && strcmp(type, "PropertyValue") == 0) {
3374 xs *val = sanitize(value);
3375 val = replace_shortnames(val, xs_dict_get(actor, "tag"), 1, proxy);
3376
3377 xs_html_add(snac_metadata,
3378 xs_html_tag("span",
3379 xs_html_attr("class", "snac-property-name"),
3380 xs_html_text(name)),
3381 xs_html_text(":"),
3382 xs_html_raw(" "),
3383 xs_html_tag("span",
3384 xs_html_attr("class", "snac-property-value"),
3385 xs_html_raw(val)),
3386 xs_html_sctag("br", NULL));
3387
3388 count++;
3389 }
3390 }
3391
3392 if (count > 0) {
3393 xs_html_add(snac_post, snac_metadata);
3394 }
3395 else {
3396 /* free the html, by rendering it... */
3397 xs_free(xs_html_render(snac_metadata));
3398 }
3399
3360 /* buttons */ 3400 /* buttons */
3361 xs *btn_form_action = xs_fmt("%s/admin/action", user->actor); 3401 xs *btn_form_action = xs_fmt("%s/admin/action", user->actor);
3362 3402