commit 072ae21

grunfink  ·  2025-05-18 07:38:38 +0000 UTC
parent 8f048b0
Operations on the 'people' page redirects back to it instead of 'admin'.
1 files changed,  +17, -4
M html.c
M html.c
+17, -4
 1@@ -3149,6 +3149,8 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c
 2                 xs_html_tag("summary",
 3                     xs_html_text("..."))));
 4 
 5+    xs *redir = xs_fmt("%s/people", user->actor);
 6+
 7     const char *actor_id;
 8 
 9     xs_list_foreach(list, actor_id) {
10@@ -3200,6 +3202,10 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c
11                     xs_html_attr("type",    "hidden"),
12                     xs_html_attr("name",    "actor"),
13                     xs_html_attr("value",   actor_id)),
14+                xs_html_sctag("input",
15+                    xs_html_attr("type",    "hidden"),
16+                    xs_html_attr("name",    "hard-redir"),
17+                    xs_html_attr("value",   redir)),
18                 xs_html_sctag("input",
19                     xs_html_attr("type",    "hidden"),
20                     xs_html_attr("name",    "actor-form"),
21@@ -5003,12 +5009,19 @@ int html_post_handler(const xs_dict *req, const char *q_path,
22     }
23 
24     if (status == HTTP_STATUS_SEE_OTHER) {
25-        const char *redir = xs_dict_get(p_vars, "redir");
26+        const char *hard_redir = xs_dict_get(p_vars, "hard-redir");
27 
28-        if (xs_is_null(redir))
29-            redir = "top";
30+        if (xs_is_string(hard_redir))
31+            *body = xs_dup(hard_redir);
32+        else {
33+            const char *redir = xs_dict_get(p_vars, "redir");
34+
35+            if (xs_is_null(redir))
36+                redir = "top";
37+
38+            *body = xs_fmt("%s/admin#%s", snac.actor, redir);
39+        }
40 
41-        *body   = xs_fmt("%s/admin#%s", snac.actor, redir);
42         *b_size = strlen(*body);
43     }
44