commit 928eeecba249456c94a44b157bdfb9f7686ce5ca
parent 581b0764fede2eebc5ce4687fcaf11749ecb4e67
Author: default <nobody@localhost>
Date: Wed, 24 Jan 2024 09:28:11 +0100
Show a handshake emoji for mutual relations (following + follower).
Diffstat:
M | html.c | | | 30 | +++++++++++++++++++++--------- |
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/html.c b/html.c
@@ -108,6 +108,8 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
xs *avatar = NULL;
char *v;
+ int fwing = 0;
+ int fwer = 0;
xs *name = actor_name(actor);
@@ -124,9 +126,12 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
xs *href = NULL;
if (user) {
+ fwer = follower_check(user, actor_id);
+ fwing = following_check(user, actor_id);
+
/* if this actor is a follower or being followed, create an
anchored link to the people page instead of the actor url */
- if (follower_check(user, actor_id) || following_check(user, actor_id)) {
+ if (fwer || fwing) {
xs *md5 = xs_md5_hex(actor_id, strlen(actor_id));
href = xs_fmt("%s/people#%s", user->actor, md5);
}
@@ -146,6 +151,21 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
xs_html_attr("class", "p-author h-card snac-author"),
xs_html_raw(name))); /* name is already html-escaped */
+ if (strcmp(xs_dict_get(actor, "type"), "Service") == 0) {
+ xs_html_add(actor_icon,
+ xs_html_text(" "),
+ xs_html_tag("span",
+ xs_html_attr("title", "bot"),
+ xs_html_raw("🤖")));
+ }
+
+ if (fwing && fwer) {
+ xs_html_add(actor_icon,
+ xs_html_text(" "),
+ xs_html_tag("span",
+ xs_html_attr("title", "mutual relation"),
+ xs_html_raw("🤝")));
+ }
if (!xs_is_null(url)) {
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,
xs_html_raw("🔒")));
}
- if (strcmp(xs_dict_get(actor, "type"), "Service") == 0) {
- xs_html_add(actor_icon,
- xs_html_text(" "),
- xs_html_tag("span",
- xs_html_attr("title", "bot"),
- xs_html_raw("🤖")));
- }
-
if (xs_is_null(date)) {
xs_html_add(actor_icon,
xs_html_raw(" "));