diff options
| author | 2025-04-24 22:27:35 +0000 | |
|---|---|---|
| committer | 2025-05-23 21:13:22 +0000 | |
| commit | b44015cf877212f1280f719ca5bb02f45a71305b (patch) | |
| tree | ba3a77c93418982d8eab9852a065a4759bf931d2 | |
| parent | Don't remove image attachments from posts that have MRFs adding links to images (diff) | |
| download | penes-snac2-b44015cf877212f1280f719ca5bb02f45a71305b.tar.gz penes-snac2-b44015cf877212f1280f719ca5bb02f45a71305b.tar.xz penes-snac2-b44015cf877212f1280f719ca5bb02f45a71305b.zip | |
Normalise CWs and summaries to fit more *oma usage rather than friendicaukko-2.75
| -rw-r--r-- | html.c | 25 |
1 files changed, 7 insertions, 18 deletions
| @@ -2130,11 +2130,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2130 | 2130 | ||
| 2131 | v = xs_dict_get(msg, "summary"); | 2131 | v = xs_dict_get(msg, "summary"); |
| 2132 | 2132 | ||
| 2133 | /* is it sensitive? */ | 2133 | if (!xs_is_null(v) && *v) { |
| 2134 | if (xs_type(xs_dict_get(msg, "sensitive")) == XSTYPE_TRUE) { | ||
| 2135 | if (xs_is_null(v) || *v == '\0') | ||
| 2136 | v = "..."; | ||
| 2137 | |||
| 2138 | const char *cw = ""; | 2134 | const char *cw = ""; |
| 2139 | 2135 | ||
| 2140 | if (user) { | 2136 | if (user) { |
| @@ -2144,23 +2140,16 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2144 | cw = ""; | 2140 | cw = ""; |
| 2145 | } | 2141 | } |
| 2146 | 2142 | ||
| 2143 | xs_html *summary_tag = xs_html_tag("summary", xs_html_text(v)); | ||
| 2144 | if (xs_type(xs_dict_get(msg, "sensitive")) == XSTYPE_TRUE) { | ||
| 2145 | xs_html_add(summary_tag, xs_html_text(L(" [SENSITIVE CONTENT]"))); | ||
| 2146 | } | ||
| 2147 | |||
| 2147 | snac_content = xs_html_tag("details", | 2148 | snac_content = xs_html_tag("details", |
| 2148 | xs_html_attr(cw, NULL), | 2149 | xs_html_attr(cw, NULL), |
| 2149 | xs_html_tag("summary", | 2150 | summary_tag); |
| 2150 | xs_html_text(v), | ||
| 2151 | xs_html_text(L(" [SENSITIVE CONTENT]")))); | ||
| 2152 | } | 2151 | } |
| 2153 | else { | 2152 | else { |
| 2154 | /* print the summary as a header (sites like e.g. Friendica can contain one) */ | ||
| 2155 | if (!has_title && !xs_is_null(v) && *v) { | ||
| 2156 | xs_html_add(snac_content_wrap, | ||
| 2157 | xs_html_tag("h3", | ||
| 2158 | xs_html_attr("class", "snac-entry-title"), | ||
| 2159 | xs_html_text(v))); | ||
| 2160 | |||
| 2161 | has_title = 1; | ||
| 2162 | } | ||
| 2163 | |||
| 2164 | snac_content = xs_html_tag("div", NULL); | 2153 | snac_content = xs_html_tag("div", NULL); |
| 2165 | } | 2154 | } |
| 2166 | 2155 | ||