From 073140eced076d2ec78aa3aae72c0429168ceb5f Mon Sep 17 00:00:00 2001 From: default Date: Thu, 23 Nov 2023 22:55:20 +0100 Subject: [PATCH] The post edit box also uses html_note(). --- html.c | 60 +++++++++++++++------------------------------------------- 1 file changed, 15 insertions(+), 45 deletions(-) diff --git a/html.c b/html.c index a923771..fc2091f 100644 --- a/html.c +++ b/html.c @@ -1065,54 +1065,24 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch s = xs_str_cat(s, "\n"); - const char *prev_src1 = xs_dict_get(msg, "sourceContent"); - - if (!xs_is_null(prev_src1) && strcmp(actor, snac->actor) == 0) { /** edit **/ - xs *prev_src = encode_html(prev_src1); - const xs_val *sensitive = xs_dict_get(msg, "sensitive"); - const char *summary = xs_dict_get(msg, "summary"); + char *prev_src = xs_dict_get(msg, "sourceContent"); + if (!xs_is_null(prev_src) && strcmp(actor, snac->actor) == 0) { /** edit **/ /* post can be edited */ - xs *s1 = xs_fmt( - "

%s\n" - "

\n" - "
\n" - "\n" - "\n" + xs *div_id = xs_fmt("%s_edit", md5); + xs *form_id = xs_fmt("%s_edit_form", md5); + xs *redir = xs_fmt("%s_entry", md5); - "

%s: " - "\n" - "

%s: \n" + xs_html *h = xs_html_tag("p", + html_note(snac, L("Edit..."), + div_id, form_id, + "", prev_src, + (char *)id, NULL, + xs_dict_get(msg, "sensitive"), xs_dict_get(msg, "summary"), + xs_stock_false, redir, + NULL, 0)); - "

%s\n" - "

%s: \n" - "

%s: \n" - "

\n" - - "\n" - "

\n" - "

\n" - "

" - "\n", - - L("Edit..."), - md5, - snac->actor, md5, - prev_src, - id, - L("Sensitive content"), - xs_type(sensitive) == XSTYPE_TRUE ? "checked" : "", - L("Sensitive content description"), - xs_is_null(summary) ? "" : summary, - L("Only for mentioned people"), - L("Attach..."), - L("File"), - L("File description"), - md5, - L("Post") - ); + xs *s1 = xs_html_render(h); s = xs_str_cat(s, s1); } @@ -1125,7 +1095,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch xs *redir = xs_fmt("%s_entry", md5); xs_html *h = xs_html_tag("p", - html_note(snac, L("Reply..."), + html_note(snac, L("Reply..."), div_id, form_id, "", ct, NULL, NULL,