diff options
author | default <nobody@localhost> | 2022-10-01 18:58:50 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2022-10-01 18:58:50 +0200 |
commit | bd0bc09912bd35e7ab7df19d93df9fd91df25957 (patch) | |
tree | 13508a1fc7aab653d78d49043d9224f0cd5839dc | |
parent | 37925a020e11982ef0c77685f04e9ad85cee749c (diff) |
Show a link in the snac-origin in level 0 entries.
-rw-r--r-- | html.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -526,11 +526,12 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i if (level == 0) { char *referrer; + char *parent; s = xs_str_cat(s, "<div class=\"snac-post\">\n"); /* print the origin of the post, if any */ - if ((referrer = xs_dict_get(meta, "referrer")) != NULL) { + if (!xs_is_null(referrer = xs_dict_get(meta, "referrer"))) { xs *actor_r = NULL; if (valid_status(actor_get(snac, referrer, &actor_r))) { @@ -550,6 +551,17 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i s = xs_str_cat(s, s1); } } + else + if (!xs_is_null((parent = xs_dict_get(meta, "parent")))) { + /* this may happen if any of the autor or the parent aren't here */ + xs *s1 = xs_fmt( + "<div class=\"snac-origin\">%s " + "<a href=\"%s\">ยป</a></div>\n", + L("in reply to"), parent + ); + + s = xs_str_cat(s, s1); + } } else s = xs_str_cat(s, "<div class=\"snac-child\">\n"); |