Followers can be deleted.

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

36
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,22 +1553,28 @@ 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) {
/* delete an entry */ if (actor != NULL) {
if (xs_startswith(id, snac.actor)) { /* delete follower */
/* it's a post by us: generate a delete */ if (valid_status(follower_del(&snac, actor)))
xs *msg = msg_delete(&snac, id); snac_log(&snac, xs_fmt("deleted follower %s", actor));
else
enqueue_message(&snac, msg); snac_log(&snac, xs_fmt("error deleting follower %s", actor));
/* FIXME: also post this Tombstone to people
that Announce'd it */
snac_log(&snac, xs_fmt("posted tombstone for %s", id));
} }
else {
/* delete an entry */
if (xs_startswith(id, snac.actor)) {
/* it's a post by us: generate a delete */
xs *msg = msg_delete(&snac, id);
timeline_del(&snac, id); enqueue_message(&snac, msg);
snac_log(&snac, xs_fmt("deleted entry %s", id)); snac_log(&snac, xs_fmt("posted tombstone for %s", id));
}
timeline_del(&snac, id);
snac_log(&snac, xs_fmt("deleted entry %s", id));
}
} }
else else
status = 404; status = 404;