summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/html.c b/html.c
index e02c62b..5140a11 100644
--- a/html.c
+++ b/html.c
@@ -108,6 +108,8 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
108 108
109 xs *avatar = NULL; 109 xs *avatar = NULL;
110 char *v; 110 char *v;
111 int fwing = 0;
112 int fwer = 0;
111 113
112 xs *name = actor_name(actor); 114 xs *name = actor_name(actor);
113 115
@@ -124,9 +126,12 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
124 xs *href = NULL; 126 xs *href = NULL;
125 127
126 if (user) { 128 if (user) {
129 fwer = follower_check(user, actor_id);
130 fwing = following_check(user, actor_id);
131
127 /* if this actor is a follower or being followed, create an 132 /* if this actor is a follower or being followed, create an
128 anchored link to the people page instead of the actor url */ 133 anchored link to the people page instead of the actor url */
129 if (follower_check(user, actor_id) || following_check(user, actor_id)) { 134 if (fwer || fwing) {
130 xs *md5 = xs_md5_hex(actor_id, strlen(actor_id)); 135 xs *md5 = xs_md5_hex(actor_id, strlen(actor_id));
131 href = xs_fmt("%s/people#%s", user->actor, md5); 136 href = xs_fmt("%s/people#%s", user->actor, md5);
132 } 137 }
@@ -146,6 +151,21 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
146 xs_html_attr("class", "p-author h-card snac-author"), 151 xs_html_attr("class", "p-author h-card snac-author"),
147 xs_html_raw(name))); /* name is already html-escaped */ 152 xs_html_raw(name))); /* name is already html-escaped */
148 153
154 if (strcmp(xs_dict_get(actor, "type"), "Service") == 0) {
155 xs_html_add(actor_icon,
156 xs_html_text(" "),
157 xs_html_tag("span",
158 xs_html_attr("title", "bot"),
159 xs_html_raw("🤖")));
160 }
161
162 if (fwing && fwer) {
163 xs_html_add(actor_icon,
164 xs_html_text(" "),
165 xs_html_tag("span",
166 xs_html_attr("title", "mutual relation"),
167 xs_html_raw("🤝")));
168 }
149 169
150 if (!xs_is_null(url)) { 170 if (!xs_is_null(url)) {
151 xs *md5 = xs_md5_hex(url, strlen(url)); 171 xs *md5 = xs_md5_hex(url, strlen(url));
@@ -166,14 +186,6 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
166 xs_html_raw("🔒"))); 186 xs_html_raw("🔒")));
167 } 187 }
168 188
169 if (strcmp(xs_dict_get(actor, "type"), "Service") == 0) {
170 xs_html_add(actor_icon,
171 xs_html_text(" "),
172 xs_html_tag("span",
173 xs_html_attr("title", "bot"),
174 xs_html_raw("🤖")));
175 }
176
177 if (xs_is_null(date)) { 189 if (xs_is_null(date)) {
178 xs_html_add(actor_icon, 190 xs_html_add(actor_icon,
179 xs_html_raw(" ")); 191 xs_html_raw(" "));