mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-09 19:50:26 +03:00
Merge pull request 'Enable deletion of avatar and header image in user settings' (#168) from louis77/snac2:master into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/168
This commit is contained in:
commit
411a0f0db9
20
html.c
20
html.c
@ -1012,12 +1012,22 @@ xs_html *html_top_controls(snac *snac)
|
||||
xs_html_sctag("input",
|
||||
xs_html_attr("type", "file"),
|
||||
xs_html_attr("name", "avatar_file"))),
|
||||
xs_html_tag("p",
|
||||
xs_html_sctag("input",
|
||||
xs_html_attr("type", "checkbox"),
|
||||
xs_html_attr("name", "avatar_delete")),
|
||||
xs_html_text(L("Delete current avatar"))),
|
||||
xs_html_tag("p",
|
||||
xs_html_text(L("Header image (banner): ")),
|
||||
xs_html_sctag("input",
|
||||
xs_html_attr("type", "file"),
|
||||
xs_html_attr("name", "header_file"))),
|
||||
xs_html_tag("p",
|
||||
xs_html_sctag("input",
|
||||
xs_html_attr("type", "checkbox"),
|
||||
xs_html_attr("name", "header_delete")),
|
||||
xs_html_text(L("Delete current header image"))),
|
||||
xs_html_tag("p",
|
||||
xs_html_text(L("Bio:")),
|
||||
xs_html_sctag("br", NULL),
|
||||
xs_html_tag("textarea",
|
||||
@ -3306,6 +3316,16 @@ int html_post_handler(const xs_dict *req, const char *q_path,
|
||||
}
|
||||
}
|
||||
|
||||
/* delete images by removing url from user.json */
|
||||
for (n = 0; uploads[n]; n++) {
|
||||
xs *var_name = xs_fmt("%s_delete", uploads[n]);
|
||||
const char *delete_var = xs_dict_get(p_vars, var_name);
|
||||
|
||||
if (delete_var != NULL && strcmp(delete_var, "on") == 0) {
|
||||
snac.config = xs_dict_set(snac.config, uploads[n], "");
|
||||
}
|
||||
}
|
||||
|
||||
/* password change? */
|
||||
if ((p1 = xs_dict_get(p_vars, "passwd1")) != NULL &&
|
||||
(p2 = xs_dict_get(p_vars, "passwd2")) != NULL &&
|
||||
|
Loading…
Reference in New Issue
Block a user