commit 048ee35
default
·
2023-04-16 04:08:33 +0000 UTC
parent 7bec30e
New button to clear all notifications.
1 files changed,
+13,
-0
M
html.c
M
html.c
+13,
-0
1@@ -1199,6 +1199,12 @@ xs_str *html_notifications(snac *snac)
2
3 s = html_user_header(snac, s, 0);
4
5+ xs *s1 = xs_fmt(
6+ "<form method=\"post\" action=\"%s/admin/clear-notifications\" id=\"clear\">\n"
7+ "<input type=\"submit\" class=\"snac-btn-like\" value=\"%s\">\n"
8+ "</form><p>", snac->actor, L("Clear all"));
9+ s = xs_str_cat(s, s1);
10+
11 while (xs_list_iter(&p, &v)) {
12 xs *noti = notify_get(snac, v);
13
14@@ -1865,6 +1871,13 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
15
16 status = 303;
17 }
18+ else
19+ if (p_path && strcmp(p_path, "admin/clear-notifications") == 0) {
20+ notify_clear(&snac);
21+ timeline_touch(&snac);
22+
23+ status = 303;
24+ }
25
26 if (status == 303) {
27 char *redir = xs_dict_get(p_vars, "redir");