diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 40 |
1 files changed, 40 insertions, 0 deletions
| @@ -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 | ||