diff options
| author | 2022-10-01 18:58:50 +0200 | |
|---|---|---|
| committer | 2022-10-01 18:58:50 +0200 | |
| commit | bd0bc09912bd35e7ab7df19d93df9fd91df25957 (patch) | |
| tree | 13508a1fc7aab653d78d49043d9224f0cd5839dc | |
| parent | timeline_request() also triggers an actor_request(). (diff) | |
| download | snac2-bd0bc09912bd35e7ab7df19d93df9fd91df25957.tar.gz snac2-bd0bc09912bd35e7ab7df19d93df9fd91df25957.tar.xz snac2-bd0bc09912bd35e7ab7df19d93df9fd91df25957.zip | |
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 | |||
| 526 | 526 | ||
| 527 | if (level == 0) { | 527 | if (level == 0) { |
| 528 | char *referrer; | 528 | char *referrer; |
| 529 | char *parent; | ||
| 529 | 530 | ||
| 530 | s = xs_str_cat(s, "<div class=\"snac-post\">\n"); | 531 | s = xs_str_cat(s, "<div class=\"snac-post\">\n"); |
| 531 | 532 | ||
| 532 | /* print the origin of the post, if any */ | 533 | /* print the origin of the post, if any */ |
| 533 | if ((referrer = xs_dict_get(meta, "referrer")) != NULL) { | 534 | if (!xs_is_null(referrer = xs_dict_get(meta, "referrer"))) { |
| 534 | xs *actor_r = NULL; | 535 | xs *actor_r = NULL; |
| 535 | 536 | ||
| 536 | if (valid_status(actor_get(snac, referrer, &actor_r))) { | 537 | 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 | |||
| 550 | s = xs_str_cat(s, s1); | 551 | s = xs_str_cat(s, s1); |
| 551 | } | 552 | } |
| 552 | } | 553 | } |
| 554 | else | ||
| 555 | if (!xs_is_null((parent = xs_dict_get(meta, "parent")))) { | ||
| 556 | /* this may happen if any of the autor or the parent aren't here */ | ||
| 557 | xs *s1 = xs_fmt( | ||
| 558 | "<div class=\"snac-origin\">%s " | ||
| 559 | "<a href=\"%s\">ยป</a></div>\n", | ||
| 560 | L("in reply to"), parent | ||
| 561 | ); | ||
| 562 | |||
| 563 | s = xs_str_cat(s, s1); | ||
| 564 | } | ||
| 553 | } | 565 | } |
| 554 | else | 566 | else |
| 555 | s = xs_str_cat(s, "<div class=\"snac-child\">\n"); | 567 | s = xs_str_cat(s, "<div class=\"snac-child\">\n"); |