diff options
| author | 2023-12-08 07:04:10 +0100 | |
|---|---|---|
| committer | 2023-12-08 07:04:10 +0100 | |
| commit | c9b8f8cfef97f641015ab345fba81c074a8245b9 (patch) | |
| tree | 6bf9262e28a6d0592c3f6244cefed56c663fa2bd /html.c | |
| parent | Backport from xs. (diff) | |
| download | snac2-c9b8f8cfef97f641015ab345fba81c074a8245b9.tar.gz snac2-c9b8f8cfef97f641015ab345fba81c074a8245b9.tar.xz snac2-c9b8f8cfef97f641015ab345fba81c074a8245b9.zip | |
Show a note's summary as a header.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 14 |
1 files changed, 12 insertions, 2 deletions
| @@ -1388,9 +1388,11 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local, | |||
| 1388 | 1388 | ||
| 1389 | xs_html *snac_content = NULL; | 1389 | xs_html *snac_content = NULL; |
| 1390 | 1390 | ||
| 1391 | v = xs_dict_get(msg, "summary"); | ||
| 1392 | |||
| 1391 | /* is it sensitive? */ | 1393 | /* is it sensitive? */ |
| 1392 | if (user && xs_type(xs_dict_get(msg, "sensitive")) == XSTYPE_TRUE) { | 1394 | if (user && xs_type(xs_dict_get(msg, "sensitive")) == XSTYPE_TRUE) { |
| 1393 | if (xs_is_null(v = xs_dict_get(msg, "summary")) || *v == '\0') | 1395 | if (xs_is_null(v) || *v == '\0') |
| 1394 | v = "..."; | 1396 | v = "..."; |
| 1395 | 1397 | ||
| 1396 | /* only show it when not in the public timeline and the config setting is "open" */ | 1398 | /* only show it when not in the public timeline and the config setting is "open" */ |
| @@ -1404,8 +1406,16 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local, | |||
| 1404 | xs_html_text(v), | 1406 | xs_html_text(v), |
| 1405 | xs_html_text(L(" [SENSITIVE CONTENT]")))); | 1407 | xs_html_text(L(" [SENSITIVE CONTENT]")))); |
| 1406 | } | 1408 | } |
| 1407 | else | 1409 | else { |
| 1410 | /* print the summary as a header (sites like e.g. Friendica can contain one) */ | ||
| 1411 | if (!xs_is_null(v) && *v) | ||
| 1412 | xs_html_add(snac_content_wrap, | ||
| 1413 | xs_html_tag("h3", | ||
| 1414 | xs_html_attr("class", "snac-entry-title"), | ||
| 1415 | xs_html_text(v))); | ||
| 1416 | |||
| 1408 | snac_content = xs_html_tag("div", NULL); | 1417 | snac_content = xs_html_tag("div", NULL); |
| 1418 | } | ||
| 1409 | 1419 | ||
| 1410 | xs_html_add(snac_content_wrap, | 1420 | xs_html_add(snac_content_wrap, |
| 1411 | snac_content); | 1421 | snac_content); |