summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Uko Kokņevičs2025-04-24 22:27:35 +0000
committerGravatar Uko Kokņevičs2025-11-02 06:26:42 +0000
commit00b73f3dbc676ba3ca5bc7de7a408d27abf71de8 (patch)
tree14ff1ff78bbfcb61a8b243dd4608fa094faa78c1
parentDon't remove image attachments from posts that have MRFs adding links to images (diff)
downloadpenes-snac2-00b73f3dbc676ba3ca5bc7de7a408d27abf71de8.tar.gz
penes-snac2-00b73f3dbc676ba3ca5bc7de7a408d27abf71de8.tar.xz
penes-snac2-00b73f3dbc676ba3ca5bc7de7a408d27abf71de8.zip
Normalise CWs and summaries to fit more *oma usage rather than friendica
-rw-r--r--html.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/html.c b/html.c
index 2b11436..2ff1259 100644
--- a/html.c
+++ b/html.c
@@ -2242,11 +2242,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2242 2242
2243 v = xs_dict_get(msg, "summary"); 2243 v = xs_dict_get(msg, "summary");
2244 2244
2245 /* is it sensitive? */ 2245 if (!xs_is_null(v) && *v) {
2246 if (xs_type(xs_dict_get(msg, "sensitive")) == XSTYPE_TRUE) {
2247 if (xs_is_null(v) || *v == '\0')
2248 v = "...";
2249
2250 const char *cw = ""; 2246 const char *cw = "";
2251 2247
2252 if (user) { 2248 if (user) {
@@ -2256,23 +2252,16 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2256 cw = ""; 2252 cw = "";
2257 } 2253 }
2258 2254
2255 xs_html *summary_tag = xs_html_tag("summary", xs_html_text(v));
2256 if (xs_type(xs_dict_get(msg, "sensitive")) == XSTYPE_TRUE) {
2257 xs_html_add(summary_tag, xs_html_text(L(" [SENSITIVE CONTENT]")));
2258 }
2259
2259 snac_content = xs_html_tag("details", 2260 snac_content = xs_html_tag("details",
2260 xs_html_attr(cw, NULL), 2261 xs_html_attr(cw, NULL),
2261 xs_html_tag("summary", 2262 summary_tag);
2262 xs_html_text(v),
2263 xs_html_text(L(" [SENSITIVE CONTENT]"))));
2264 } 2263 }
2265 else { 2264 else {
2266 /* print the summary as a header (sites like e.g. Friendica can contain one) */
2267 if (!has_title && !xs_is_null(v) && *v) {
2268 xs_html_add(snac_content_wrap,
2269 xs_html_tag("h3",
2270 xs_html_attr("class", "snac-entry-title"),
2271 xs_html_text(v)));
2272
2273 has_title = 1;
2274 }
2275
2276 snac_content = xs_html_tag("div", NULL); 2265 snac_content = xs_html_tag("div", NULL);
2277 } 2266 }
2278 2267