summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-04-16 06:08:33 +0200
committerdefault <nobody@localhost>2023-04-16 06:08:33 +0200
commit048ee3503918dac4d456ea297d2521beeb18c46c (patch)
treeac93a43cfa34241483af4bda0ecadf332fc0f369 /html.c
parent7bec30ee52fbfb4f998d14eb6a53a99760e2c0df (diff)
New button to clear all notifications.
Diffstat (limited to 'html.c')
-rw-r--r--html.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/html.c b/html.c
index a54c782..c9cf9e3 100644
--- a/html.c
+++ b/html.c
@@ -1199,6 +1199,12 @@ xs_str *html_notifications(snac *snac)
s = html_user_header(snac, s, 0);
+ xs *s1 = xs_fmt(
+ "<form method=\"post\" action=\"%s/admin/clear-notifications\" id=\"clear\">\n"
+ "<input type=\"submit\" class=\"snac-btn-like\" value=\"%s\">\n"
+ "</form><p>", snac->actor, L("Clear all"));
+ s = xs_str_cat(s, s1);
+
while (xs_list_iter(&p, &v)) {
xs *noti = notify_get(snac, v);
@@ -1865,6 +1871,13 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
status = 303;
}
+ else
+ if (p_path && strcmp(p_path, "admin/clear-notifications") == 0) {
+ notify_clear(&snac);
+ timeline_touch(&snac);
+
+ status = 303;
+ }
if (status == 303) {
char *redir = xs_dict_get(p_vars, "redir");