mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-12-24 00:23:38 +00:00
Added support for sensitive content.
This commit is contained in:
parent
f767507896
commit
9612289477
1 changed files with 16 additions and 0 deletions
16
html.c
16
html.c
|
@ -444,6 +444,8 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i
|
|||
char *type = xs_dict_get(msg, "type");
|
||||
char *meta = xs_dict_get(msg, "_snac");
|
||||
char *actor;
|
||||
int sensitive = 0;
|
||||
char *v;
|
||||
|
||||
/* do not show non-public messages in the public timeline */
|
||||
if (local && !is_msg_public(snac, msg))
|
||||
|
@ -563,6 +565,17 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i
|
|||
/* add the content */
|
||||
s = xs_str_cat(s, "<div class=\"e-content snac-content\">\n");
|
||||
|
||||
/* is it sensitive? */
|
||||
if (!xs_is_null(v = xs_dict_get(msg, "sensitive")) && xs_type(v) == XSTYPE_TRUE) {
|
||||
if (xs_is_null(v = xs_dict_get(msg, "summary")) || *v == '\0')
|
||||
v = "...";
|
||||
|
||||
xs *s1 = xs_fmt("<details><summary>%s [%s]</summary>\n", v, L("SENSITIVE CONTENT"));
|
||||
s = xs_str_cat(s, s1);
|
||||
|
||||
sensitive = 1;
|
||||
}
|
||||
|
||||
{
|
||||
xs *c = xs_dup(xs_dict_get(msg, "content"));
|
||||
char *p, *v;
|
||||
|
@ -642,6 +655,9 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i
|
|||
}
|
||||
}
|
||||
|
||||
if (sensitive)
|
||||
s = xs_str_cat(s, "</details><p>\n");
|
||||
|
||||
s = xs_str_cat(s, "</div>\n");
|
||||
|
||||
/** controls **/
|
||||
|
|
Loading…
Reference in a new issue