commit f205d20
default
·
2022-12-03 17:08:44 +0000 UTC
parent d00026a
Always show who boosted something, not only when it's on level 0.
1 files changed,
+42,
-43
M
html.c
M
html.c
+42,
-43
1@@ -548,57 +548,43 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int
2 s = xs_str_cat(s, s1);
3 }
4
5- if (level == 0) {
6+ if (level == 0)
7 s = xs_str_cat(s, "<div class=\"snac-post\">\n");
8+ else
9+ s = xs_str_cat(s, "<div class=\"snac-child\">\n");
10
11- if (boosts == NULL)
12- boosts = object_announces(id);
13-
14- if (xs_list_len(boosts)) {
15- /* if somebody boosted this, show as origin */
16- char *p = xs_list_get(boosts, -1);
17- xs *actor_r = NULL;
18-
19- if (xs_list_in(boosts, snac->md5) != -1) {
20- /* we boosted this */
21- xs *s1 = xs_fmt(
22- "<div class=\"snac-origin\">"
23- "<a href=\"%s\">%s</a> %s</a></div>",
24- snac->actor, xs_dict_get(snac->config, "name"), L("boosted")
25- );
26-
27- s = xs_str_cat(s, s1);
28- }
29- else
30- if (valid_status(object_get_by_md5(p, &actor_r, NULL))) {
31- char *name;
32+ if (boosts == NULL)
33+ boosts = object_announces(id);
34
35- if ((name = xs_dict_get(actor_r, "name")) == NULL)
36- name = xs_dict_get(actor_r, "preferredUsername");
37+ if (xs_list_len(boosts)) {
38+ /* if somebody boosted this, show as origin */
39+ char *p = xs_list_get(boosts, -1);
40+ xs *actor_r = NULL;
41
42- if (!xs_is_null(name)) {
43- xs *s1 = xs_fmt(
44- "<div class=\"snac-origin\">"
45- "<a href=\"%s\">%s</a> %s</div>\n",
46- xs_dict_get(actor_r, "id"),
47- name,
48- L("boosted")
49- );
50+ if (xs_list_in(boosts, snac->md5) != -1) {
51+ /* we boosted this */
52+ xs *s1 = xs_fmt(
53+ "<div class=\"snac-origin\">"
54+ "<a href=\"%s\">%s</a> %s</a></div>",
55+ snac->actor, xs_dict_get(snac->config, "name"), L("boosted")
56+ );
57
58- s = xs_str_cat(s, s1);
59- }
60- }
61+ s = xs_str_cat(s, s1);
62 }
63 else
64- if (strcmp(type, "Note") == 0) {
65- /* is the parent not here? */
66- char *parent = xs_dict_get(msg, "inReplyTo");
67+ if (valid_status(object_get_by_md5(p, &actor_r, NULL))) {
68+ char *name;
69
70- if (!xs_is_null(parent) && *parent && !object_here(parent)) {
71+ if ((name = xs_dict_get(actor_r, "name")) == NULL)
72+ name = xs_dict_get(actor_r, "preferredUsername");
73+
74+ if (!xs_is_null(name)) {
75 xs *s1 = xs_fmt(
76- "<div class=\"snac-origin\">%s "
77- "<a href=\"%s\">»</a></div>\n",
78- L("in reply to"), parent
79+ "<div class=\"snac-origin\">"
80+ "<a href=\"%s\">%s</a> %s</div>\n",
81+ xs_dict_get(actor_r, "id"),
82+ name,
83+ L("boosted")
84 );
85
86 s = xs_str_cat(s, s1);
87@@ -606,7 +592,20 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int
88 }
89 }
90 else
91- s = xs_str_cat(s, "<div class=\"snac-child\">\n");
92+ if (strcmp(type, "Note") == 0) {
93+ /* is the parent not here? */
94+ char *parent = xs_dict_get(msg, "inReplyTo");
95+
96+ if (!xs_is_null(parent) && *parent && !object_here(parent)) {
97+ xs *s1 = xs_fmt(
98+ "<div class=\"snac-origin\">%s "
99+ "<a href=\"%s\">»</a></div>\n",
100+ L("in reply to"), parent
101+ );
102+
103+ s = xs_str_cat(s, s1);
104+ }
105+ }
106
107 s = html_msg_icon(snac, s, msg);
108