Followers can be deleted.

This commit is contained in:
default 2023-02-08 20:19:36 +01:00
parent 2ed2914fa3
commit 436dbf9913

16
html.c
View File

@ -1030,8 +1030,10 @@ d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *heade
if (following_check(snac, actor_id)) if (following_check(snac, actor_id))
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"));
s = html_button(s, "delete", L("Delete"));
}
if (is_muted(snac, actor_id)) if (is_muted(snac, actor_id))
s = html_button(s, "unmute", L("Unmute")); s = html_button(s, "unmute", L("Unmute"));
@ -1551,6 +1553,14 @@ 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) {
if (actor != NULL) {
/* delete follower */
if (valid_status(follower_del(&snac, actor)))
snac_log(&snac, xs_fmt("deleted follower %s", actor));
else
snac_log(&snac, xs_fmt("error deleting follower %s", actor));
}
else {
/* delete an entry */ /* delete an entry */
if (xs_startswith(id, snac.actor)) { if (xs_startswith(id, snac.actor)) {
/* it's a post by us: generate a delete */ /* it's a post by us: generate a delete */
@ -1558,9 +1568,6 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
enqueue_message(&snac, msg); enqueue_message(&snac, msg);
/* FIXME: also post this Tombstone to people
that Announce'd it */
snac_log(&snac, xs_fmt("posted tombstone for %s", id)); snac_log(&snac, xs_fmt("posted tombstone for %s", id));
} }
@ -1568,6 +1575,7 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
snac_log(&snac, xs_fmt("deleted entry %s", id)); snac_log(&snac, xs_fmt("deleted entry %s", id));
} }
}
else else
status = 404; status = 404;