Improved Delete button fix.

This commit is contained in:
default 2023-02-10 23:04:42 +01:00
parent 2a47bdd572
commit f325b567e3

11
html.c
View file

@ -1022,10 +1022,9 @@ d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *heade
xs *s1 = xs_fmt( xs *s1 = xs_fmt(
"<p><form method=\"post\" action=\"%s/admin/action\">\n" "<p><form method=\"post\" action=\"%s/admin/action\">\n"
"<input type=\"hidden\" name=\"actor\" value=\"%s\">\n" "<input type=\"hidden\" name=\"actor\" value=\"%s\">\n"
"<input type=\"hidden\" name=\"actor-delete\" value=\"%s\">\n", "<input type=\"hidden\" name=\"actor-form\" value=\"yes\">\n",
snac->actor, actor_id, snac->actor, actor_id
md5, t
); );
s = xs_str_cat(s, s1); s = xs_str_cat(s, s1);
@ -1033,6 +1032,8 @@ d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *heade
s = html_button(s, "unfollow", L("Unfollow")); s = html_button(s, "unfollow", L("Unfollow"));
else { else {
s = html_button(s, "follow", L("Follow")); s = html_button(s, "follow", L("Follow"));
if (follower_check(snac, actor_id))
s = html_button(s, "delete", L("Delete")); s = html_button(s, "delete", L("Delete"));
} }
@ -1554,8 +1555,8 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
} }
else else
if (strcmp(action, L("Delete")) == 0) { if (strcmp(action, L("Delete")) == 0) {
char *actor_delete = xs_dict_get(p_vars, "actor-delete"); char *actor_form = xs_dict_get(p_vars, "actor-form");
if (actor_delete != NULL) { if (actor_form != NULL) {
/* delete follower */ /* delete follower */
if (valid_status(follower_del(&snac, actor))) if (valid_status(follower_del(&snac, actor)))
snac_log(&snac, xs_fmt("deleted follower %s", actor)); snac_log(&snac, xs_fmt("deleted follower %s", actor));