commit d49ae2d
default
·
2024-09-27 15:36:49 +0000 UTC
parent 2d2a685
When editing a draft, the checkbox is kept set.
1 files changed,
+9,
-6
M
html.c
M
html.c
+9,
-6
1@@ -278,7 +278,9 @@ xs_html *html_note(snac *user, const char *summary,
2 const xs_val *cw_yn, const char *cw_text,
3 const xs_val *mnt_only, const char *redir,
4 const char *in_reply_to, int poll,
5- const char *att_file, const char *att_alt_text)
6+ const char *att_file, const char *att_alt_text,
7+ int is_draft)
8+/* Yes, this is a FUCKTON of arguments and I'm a bit embarrased */
9 {
10 xs *action = xs_fmt("%s/admin/note", user->actor);
11
12@@ -363,7 +365,8 @@ xs_html *html_note(snac *user, const char *summary,
13 xs_html_text(L("Draft:")),
14 xs_html_sctag("input",
15 xs_html_attr("type", "checkbox"),
16- xs_html_attr("name", "is_draft")));
17+ xs_html_attr("name", "is_draft"),
18+ xs_html_attr(is_draft ? "checked" : "", NULL)));
19
20 if (edit_id)
21 xs_html_add(form,
22@@ -924,7 +927,7 @@ xs_html *html_top_controls(snac *snac)
23 NULL, NULL,
24 xs_stock(XSTYPE_FALSE), "",
25 xs_stock(XSTYPE_FALSE), NULL,
26- NULL, 1, "", ""),
27+ NULL, 1, "", "", 0),
28
29 /** operations **/
30 xs_html_tag("details",
31@@ -1412,7 +1415,7 @@ xs_html *html_entry_controls(snac *snac, const char *actor,
32 id, NULL,
33 xs_dict_get(msg, "sensitive"), xs_dict_get(msg, "summary"),
34 xs_stock(is_msg_public(msg) ? XSTYPE_FALSE : XSTYPE_TRUE), redir,
35- NULL, 0, att_file, att_alt_text)),
36+ NULL, 0, att_file, att_alt_text, is_draft(snac, id))),
37 xs_html_tag("p", NULL));
38 }
39
40@@ -1431,7 +1434,7 @@ xs_html *html_entry_controls(snac *snac, const char *actor,
41 NULL, NULL,
42 xs_dict_get(msg, "sensitive"), xs_dict_get(msg, "summary"),
43 xs_stock(is_msg_public(msg) ? XSTYPE_FALSE : XSTYPE_TRUE), redir,
44- id, 0, "", "")),
45+ id, 0, "", "", 0)),
46 xs_html_tag("p", NULL));
47 }
48
49@@ -2484,7 +2487,7 @@ xs_html *html_people_list(snac *snac, xs_list *list, char *header, char *t)
50 NULL, actor_id,
51 xs_stock(XSTYPE_FALSE), "",
52 xs_stock(XSTYPE_FALSE), NULL,
53- NULL, 0, "", ""),
54+ NULL, 0, "", "", 0),
55 xs_html_tag("p", NULL));
56
57 xs_html_add(snac_post, snac_controls);