From 7eef1b4b5e390ba8f2c64b336157d55508538e04 Mon Sep 17 00:00:00 2001 From: default Date: Wed, 6 Sep 2023 13:50:02 +0200 Subject: [PATCH] Added new buttons to Follow/Unfollow Groups. --- html.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/html.c b/html.c index 0eb68a8..e976a42 100644 --- a/html.c +++ b/html.c @@ -760,8 +760,10 @@ xs_str *build_mentions(snac *snac, const xs_dict *msg) xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const char *md5) { - char *id = xs_dict_get(msg, "id"); - char *actor = xs_dict_get(msg, "attributedTo"); + const char *id = xs_dict_get(msg, "id"); + const char *actor = xs_dict_get(msg, "attributedTo"); + const char *group = xs_dict_get(msg, "audience"); + xs *likes = object_likes(id); xs *boosts = object_announces(id); @@ -774,10 +776,11 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch "
\n" "\n" "\n" + "\n" "\n" "\n", - snac->actor, id, actor, md5 + snac->actor, id, actor, group ? group : "", md5 ); s = xs_str_cat(s, s1); @@ -812,6 +815,17 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch s = html_button(s, "follow", L("Follow"), L("Start following this user's activity")); } + if (!xs_is_null(group)) { + if (following_check(snac, group)) { + s = html_button(s, "unfollow", L("Unfollow Group"), + L("Stop following this group or channel")); + } + else { + s = html_button(s, "follow", L("Follow Group"), + L("Start following this group or channel")); + } + } + s = html_button(s, "mute", L("MUTE"), L("Block any activity from this user forever")); }