snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 7eef1b4b5e390ba8f2c64b336157d55508538e04
parent 4883bbe04f1e79eaae3ac1bb50a37ed7e0b57fa1
Author: default <nobody@localhost>
Date:   Wed,  6 Sep 2023 13:50:02 +0200

Added new buttons to Follow/Unfollow Groups.

Diffstat:
Mhtml.c | 20+++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)

diff --git 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 "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/action\">\n" "<input type=\"hidden\" name=\"id\" value=\"%s\">\n" "<input type=\"hidden\" name=\"actor\" value=\"%s\">\n" + "<input type=\"hidden\" name=\"group\" value=\"%s\">\n" "<input type=\"hidden\" name=\"redir\" value=\"%s_entry\">\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")); }