commit 928eeec

default  ·  2024-01-24 08:28:11 +0000 UTC
parent 581b076
Show a handshake emoji for mutual relations (following + follower).
1 files changed,  +21, -9
M html.c
M html.c
+21, -9
 1@@ -108,6 +108,8 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
 2 
 3     xs *avatar = NULL;
 4     char *v;
 5+    int fwing = 0;
 6+    int fwer = 0;
 7 
 8     xs *name = actor_name(actor);
 9 
10@@ -124,9 +126,12 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
11     xs *href = NULL;
12 
13     if (user) {
14+        fwer = follower_check(user, actor_id);
15+        fwing = following_check(user, actor_id);
16+
17         /* if this actor is a follower or being followed, create an
18            anchored link to the people page instead of the actor url */
19-        if (follower_check(user, actor_id) || following_check(user, actor_id)) {
20+        if (fwer || fwing) {
21             xs *md5 = xs_md5_hex(actor_id, strlen(actor_id));
22             href = xs_fmt("%s/people#%s", user->actor, md5);
23         }
24@@ -146,6 +151,21 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
25             xs_html_attr("class",   "p-author h-card snac-author"),
26             xs_html_raw(name))); /* name is already html-escaped */
27 
28+    if (strcmp(xs_dict_get(actor, "type"), "Service") == 0) {
29+        xs_html_add(actor_icon,
30+            xs_html_text(" "),
31+            xs_html_tag("span",
32+                xs_html_attr("title", "bot"),
33+                xs_html_raw("🤖")));
34+    }
35+
36+    if (fwing && fwer) {
37+        xs_html_add(actor_icon,
38+            xs_html_text(" "),
39+            xs_html_tag("span",
40+                xs_html_attr("title", "mutual relation"),
41+                xs_html_raw("🤝")));
42+    }
43 
44     if (!xs_is_null(url)) {
45         xs *md5 = xs_md5_hex(url, strlen(url));
46@@ -166,14 +186,6 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
47                 xs_html_raw("🔒")));
48     }
49 
50-    if (strcmp(xs_dict_get(actor, "type"), "Service") == 0) {
51-        xs_html_add(actor_icon,
52-            xs_html_text(" "),
53-            xs_html_tag("span",
54-                xs_html_attr("title", "bot"),
55-                xs_html_raw("🤖")));
56-    }
57-
58     if (xs_is_null(date)) {
59         xs_html_add(actor_icon,
60             xs_html_raw(" "));