New button to clear all notifications.

This commit is contained in:
default 2023-04-16 06:08:33 +02:00
parent 7bec30ee52
commit 048ee35039

13
html.c
View File

@ -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");