diff options
| author | 2025-04-24 22:27:35 +0000 | |
|---|---|---|
| committer | 2025-06-08 02:55:27 +0000 | |
| commit | aea70124667212412ef5704b839633045a578548 (patch) | |
| tree | eb997a759b3a4a4f4953c4667ee0397327cdaeda | |
| parent | Don't remove image attachments from posts that have MRFs adding links to images (diff) | |
| download | penes-snac2-aea70124667212412ef5704b839633045a578548.tar.gz penes-snac2-aea70124667212412ef5704b839633045a578548.tar.xz penes-snac2-aea70124667212412ef5704b839633045a578548.zip | |
Normalise CWs and summaries to fit more *oma usage rather than friendica
| -rw-r--r-- | html.c | 25 |
1 files changed, 7 insertions, 18 deletions
| @@ -2163,11 +2163,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2163 | 2163 | ||
| 2164 | v = xs_dict_get(msg, "summary"); | 2164 | v = xs_dict_get(msg, "summary"); |
| 2165 | 2165 | ||
| 2166 | /* is it sensitive? */ | 2166 | if (!xs_is_null(v) && *v) { |
| 2167 | if (xs_type(xs_dict_get(msg, "sensitive")) == XSTYPE_TRUE) { | ||
| 2168 | if (xs_is_null(v) || *v == '\0') | ||
| 2169 | v = "..."; | ||
| 2170 | |||
| 2171 | const char *cw = ""; | 2167 | const char *cw = ""; |
| 2172 | 2168 | ||
| 2173 | if (user) { | 2169 | if (user) { |
| @@ -2177,23 +2173,16 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2177 | cw = ""; | 2173 | cw = ""; |
| 2178 | } | 2174 | } |
| 2179 | 2175 | ||
| 2176 | xs_html *summary_tag = xs_html_tag("summary", xs_html_text(v)); | ||
| 2177 | if (xs_type(xs_dict_get(msg, "sensitive")) == XSTYPE_TRUE) { | ||
| 2178 | xs_html_add(summary_tag, xs_html_text(L(" [SENSITIVE CONTENT]"))); | ||
| 2179 | } | ||
| 2180 | |||
| 2180 | snac_content = xs_html_tag("details", | 2181 | snac_content = xs_html_tag("details", |
| 2181 | xs_html_attr(cw, NULL), | 2182 | xs_html_attr(cw, NULL), |
| 2182 | xs_html_tag("summary", | 2183 | summary_tag); |
| 2183 | xs_html_text(v), | ||
| 2184 | xs_html_text(L(" [SENSITIVE CONTENT]")))); | ||
| 2185 | } | 2184 | } |
| 2186 | else { | 2185 | else { |
| 2187 | /* print the summary as a header (sites like e.g. Friendica can contain one) */ | ||
| 2188 | if (!has_title && !xs_is_null(v) && *v) { | ||
| 2189 | xs_html_add(snac_content_wrap, | ||
| 2190 | xs_html_tag("h3", | ||
| 2191 | xs_html_attr("class", "snac-entry-title"), | ||
| 2192 | xs_html_text(v))); | ||
| 2193 | |||
| 2194 | has_title = 1; | ||
| 2195 | } | ||
| 2196 | |||
| 2197 | snac_content = xs_html_tag("div", NULL); | 2186 | snac_content = xs_html_tag("div", NULL); |
| 2198 | } | 2187 | } |
| 2199 | 2188 | ||