commit 4823f20

default  ·  2023-07-19 10:42:32 +0000 UTC
parent 7950783
If a message has an audience, its URL is shown after the content.

Messages coming from channels, communities (Lemmy) or magazines (kbin.social),
have this field set with the "parent" url.
1 files changed,  +9, -0
M html.c
M html.c
+9, -0
 1@@ -1269,6 +1269,15 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
 2         s = xs_str_cat(s, "</p>\n");
 3     }
 4 
 5+    /* has this message an audience (i.e., comes from a channel or community)? */
 6+    const char *audience = xs_dict_get(msg, "audience");
 7+    if (strcmp(type, "Page") == 0 && !xs_is_null(audience)) {
 8+        xs *es1 = encode_html(audience);
 9+        xs *s1 = xs_fmt("<p>(<a href=\"%s\" title=\"%s\">%s</a>)</p>\n",
10+            audience, L("Source channel or community"), es1);
11+        s = xs_str_cat(s, s1);
12+    }
13+
14     if (sensitive)
15         s = xs_str_cat(s, "</details><p>\n");
16