summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar default2023-09-06 13:50:02 +0200
committerGravatar default2023-09-06 13:50:02 +0200
commit7eef1b4b5e390ba8f2c64b336157d55508538e04 (patch)
tree43f7b0047caeae0e0f0c368c0c76f2dca974ce0d /html.c
parentUpdated link in README. (diff)
downloadsnac2-7eef1b4b5e390ba8f2c64b336157d55508538e04.tar.gz
snac2-7eef1b4b5e390ba8f2c64b336157d55508538e04.tar.xz
snac2-7eef1b4b5e390ba8f2c64b336157d55508538e04.zip
Added new buttons to Follow/Unfollow Groups.
Diffstat (limited to 'html.c')
-rw-r--r--html.c20
1 files 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)
760 760
761xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const char *md5) 761xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const char *md5)
762{ 762{
763 char *id = xs_dict_get(msg, "id"); 763 const char *id = xs_dict_get(msg, "id");
764 char *actor = xs_dict_get(msg, "attributedTo"); 764 const char *actor = xs_dict_get(msg, "attributedTo");
765 const char *group = xs_dict_get(msg, "audience");
766
765 xs *likes = object_likes(id); 767 xs *likes = object_likes(id);
766 xs *boosts = object_announces(id); 768 xs *boosts = object_announces(id);
767 769
@@ -774,10 +776,11 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
774 "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/action\">\n" 776 "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/action\">\n"
775 "<input type=\"hidden\" name=\"id\" value=\"%s\">\n" 777 "<input type=\"hidden\" name=\"id\" value=\"%s\">\n"
776 "<input type=\"hidden\" name=\"actor\" value=\"%s\">\n" 778 "<input type=\"hidden\" name=\"actor\" value=\"%s\">\n"
779 "<input type=\"hidden\" name=\"group\" value=\"%s\">\n"
777 "<input type=\"hidden\" name=\"redir\" value=\"%s_entry\">\n" 780 "<input type=\"hidden\" name=\"redir\" value=\"%s_entry\">\n"
778 "\n", 781 "\n",
779 782
780 snac->actor, id, actor, md5 783 snac->actor, id, actor, group ? group : "", md5
781 ); 784 );
782 785
783 s = xs_str_cat(s, s1); 786 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
812 s = html_button(s, "follow", L("Follow"), L("Start following this user's activity")); 815 s = html_button(s, "follow", L("Follow"), L("Start following this user's activity"));
813 } 816 }
814 817
818 if (!xs_is_null(group)) {
819 if (following_check(snac, group)) {
820 s = html_button(s, "unfollow", L("Unfollow Group"),
821 L("Stop following this group or channel"));
822 }
823 else {
824 s = html_button(s, "follow", L("Follow Group"),
825 L("Start following this group or channel"));
826 }
827 }
828
815 s = html_button(s, "mute", L("MUTE"), 829 s = html_button(s, "mute", L("MUTE"),
816 L("Block any activity from this user forever")); 830 L("Block any activity from this user forever"));
817 } 831 }