diff options
| author | 2024-11-24 09:14:59 +0100 | |
|---|---|---|
| committer | 2024-11-24 09:14:59 +0100 | |
| commit | 0db1cf05d1013f9b1e972ae79822f9eda4dede59 (patch) | |
| tree | b7b4c0737fb5bd614c21ced9ef863651c00ecb69 /html.c | |
| parent | Pending follow notifications are shown as "Follow Request". (diff) | |
| download | snac2-0db1cf05d1013f9b1e972ae79822f9eda4dede59.tar.gz snac2-0db1cf05d1013f9b1e972ae79822f9eda4dede59.tar.xz snac2-0db1cf05d1013f9b1e972ae79822f9eda4dede59.zip | |
New web actions "Approve" and "Discard".
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 28 |
1 files changed, 28 insertions, 0 deletions
| @@ -3700,6 +3700,34 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 3700 | timeline_touch(&snac); | 3700 | timeline_touch(&snac); |
| 3701 | } | 3701 | } |
| 3702 | else | 3702 | else |
| 3703 | if (strcmp(action, L("Approve")) == 0) { /** **/ | ||
| 3704 | xs *fwreq = pending_get(&snac, actor); | ||
| 3705 | |||
| 3706 | if (fwreq != NULL) { | ||
| 3707 | xs *reply = msg_accept(&snac, fwreq, actor); | ||
| 3708 | |||
| 3709 | enqueue_message(&snac, reply); | ||
| 3710 | |||
| 3711 | if (xs_is_null(xs_dict_get(fwreq, "published"))) { | ||
| 3712 | /* add a date if it doesn't include one (Mastodon) */ | ||
| 3713 | xs *date = xs_str_utctime(0, ISO_DATE_SPEC); | ||
| 3714 | fwreq = xs_dict_set(fwreq, "published", date); | ||
| 3715 | } | ||
| 3716 | |||
| 3717 | timeline_add(&snac, xs_dict_get(fwreq, "id"), fwreq); | ||
| 3718 | |||
| 3719 | follower_add(&snac, actor); | ||
| 3720 | |||
| 3721 | pending_del(&snac, actor); | ||
| 3722 | |||
| 3723 | snac_log(&snac, xs_fmt("new follower %s", actor)); | ||
| 3724 | } | ||
| 3725 | } | ||
| 3726 | else | ||
| 3727 | if (strcmp(action, L("Discard")) == 0) { /** **/ | ||
| 3728 | pending_del(&snac, actor); | ||
| 3729 | } | ||
| 3730 | else | ||
| 3703 | status = HTTP_STATUS_NOT_FOUND; | 3731 | status = HTTP_STATUS_NOT_FOUND; |
| 3704 | 3732 | ||
| 3705 | /* delete the cached timeline */ | 3733 | /* delete the cached timeline */ |