summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-07-19 12:42:32 +0200
committerdefault <nobody@localhost>2023-07-19 12:42:32 +0200
commit4823f2008526a1545e6a9abdccff1a54a5268b93 (patch)
tree376d7d2d5601762a9011ff346748a5f8d02f56de
parent7950783d41cabd41f691c85dd9844a74f75a6431 (diff)
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.
-rw-r--r--html.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/html.c b/html.c
index 4a2e119..ab23032 100644
--- a/html.c
+++ b/html.c
@@ -1269,6 +1269,15 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
s = xs_str_cat(s, "</p>\n");
}
+ /* has this message an audience (i.e., comes from a channel or community)? */
+ const char *audience = xs_dict_get(msg, "audience");
+ if (strcmp(type, "Page") == 0 && !xs_is_null(audience)) {
+ xs *es1 = encode_html(audience);
+ xs *s1 = xs_fmt("<p>(<a href=\"%s\" title=\"%s\">%s</a>)</p>\n",
+ audience, L("Source channel or community"), es1);
+ s = xs_str_cat(s, s1);
+ }
+
if (sensitive)
s = xs_str_cat(s, "</details><p>\n");