summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-02-08 20:19:36 +0100
committerGravatar default2023-02-08 20:19:36 +0100
commit436dbf9913192b384d815ca04d4da64e6e8a6996 (patch)
tree7a40475c508286e337b9f2876b8c3cba080ed73f
parentPrint errno in user file opening errors. (diff)
downloadsnac2-436dbf9913192b384d815ca04d4da64e6e8a6996.tar.gz
snac2-436dbf9913192b384d815ca04d4da64e6e8a6996.tar.xz
snac2-436dbf9913192b384d815ca04d4da64e6e8a6996.zip
Followers can be deleted.
-rw-r--r--html.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/html.c b/html.c
index d2ab762..fe6b14e 100644
--- a/html.c
+++ b/html.c
@@ -1030,8 +1030,10 @@ d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *heade
1030 1030
1031 if (following_check(snac, actor_id)) 1031 if (following_check(snac, actor_id))
1032 s = html_button(s, "unfollow", L("Unfollow")); 1032 s = html_button(s, "unfollow", L("Unfollow"));
1033 else 1033 else {
1034 s = html_button(s, "follow", L("Follow")); 1034 s = html_button(s, "follow", L("Follow"));
1035 s = html_button(s, "delete", L("Delete"));
1036 }
1035 1037
1036 if (is_muted(snac, actor_id)) 1038 if (is_muted(snac, actor_id))
1037 s = html_button(s, "unmute", L("Unmute")); 1039 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,
1551 } 1553 }
1552 else 1554 else
1553 if (strcmp(action, L("Delete")) == 0) { 1555 if (strcmp(action, L("Delete")) == 0) {
1554 /* delete an entry */ 1556 if (actor != NULL) {
1555 if (xs_startswith(id, snac.actor)) { 1557 /* delete follower */
1556 /* it's a post by us: generate a delete */ 1558 if (valid_status(follower_del(&snac, actor)))
1557 xs *msg = msg_delete(&snac, id); 1559 snac_log(&snac, xs_fmt("deleted follower %s", actor));
1558 1560 else
1559 enqueue_message(&snac, msg); 1561 snac_log(&snac, xs_fmt("error deleting follower %s", actor));
1562 }
1563 else {
1564 /* delete an entry */
1565 if (xs_startswith(id, snac.actor)) {
1566 /* it's a post by us: generate a delete */
1567 xs *msg = msg_delete(&snac, id);
1560 1568
1561 /* FIXME: also post this Tombstone to people 1569 enqueue_message(&snac, msg);
1562 that Announce'd it */
1563 1570
1564 snac_log(&snac, xs_fmt("posted tombstone for %s", id)); 1571 snac_log(&snac, xs_fmt("posted tombstone for %s", id));
1565 } 1572 }
1566 1573
1567 timeline_del(&snac, id); 1574 timeline_del(&snac, id);
1568 1575
1569 snac_log(&snac, xs_fmt("deleted entry %s", id)); 1576 snac_log(&snac, xs_fmt("deleted entry %s", id));
1577 }
1570 } 1578 }
1571 else 1579 else
1572 status = 404; 1580 status = 404;