commit e776bf7

Yonle  ·  2023-07-24 13:36:35 +0000 UTC
parent 68d03d6
html.c: Rollback to e9adaa1f7a, Put "User Settings..." outside of "Operations..."'s <details> element

Signed-off-by: Yonle <yonle@lecturify.net>
1 files changed,  +11, -33
M html.c
M html.c
+11, -33
  1@@ -1,4 +1,4 @@
  2-/* snac - A simple, minimalistic ActivityPub instance */
  3+	/* snac - A simple, minimalistic ActivityPub instance */
  4 /* copyright (c) 2022 - 2023 grunfink / MIT license */
  5 
  6 #include "xs.h"
  7@@ -343,14 +343,11 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
  8                 "<a href=\"../%s\">%s</a> - "
  9                 "<a href=\"admin\">%s</a> - "
 10                 "<a href=\"notifications\">%s</a>%s - "
 11-                "<a href=\"people\">%s</a></nav>\n"
 12-                "<a href=\"settings\">%s</a>"
 13-                "</nav>",
 14+                "<a href=\"people\">%s</a></nav>\n",
 15                 snac->uid, L("public"),
 16                 L("private"),
 17                 L("notifications"), n_str,
 18-                L("people"),
 19-                L("settings"));
 20+                L("people"));
 21         }
 22 
 23         s = xs_str_cat(s, s1);
 24@@ -388,13 +385,13 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
 25 }
 26 
 27 
 28-xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
 29+d_char *html_top_controls(snac *snac, d_char *s)
 30 /* generates the top controls */
 31 {
 32     char *_tmpl =
 33         "<div class=\"snac-top-controls\">\n"
 34 
 35-        "<div class=\"snac-note\" %s>\n"
 36+        "<div class=\"snac-note\">\n"
 37         "<details><summary>%s</summary>\n"
 38         "<form autocomplete=\"off\" method=\"post\" "
 39         "action=\"admin/note\" enctype=\"multipart/form-data\">\n"
 40@@ -431,8 +428,8 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
 41         "</div>\n"
 42         "</details>\n"
 43 
 44-        "<div class=\"snac-top-controls-more\" %s>\n"
 45-        "<p><details><summary>%s</summary>\n"
 46+        "<div class=\"snac-top-controls-more\">\n"
 47+        "<details><summary>%s</summary>\n"
 48 
 49         "<form autocomplete=\"off\" method=\"post\" action=\"admin/action\">\n" /** follow **/
 50         "<input type=\"text\" name=\"actor\" required=\"required\" placeholder=\"bob@example.com\">\n"
 51@@ -444,11 +441,8 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
 52         "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n"
 53         "</form><p>\n"
 54         "</details>\n"
 55-        "</div>\n"
 56-
 57-        "<div class=\"snac-user-settings\" %s>\n"
 58 
 59-        "<h2 class=\"snac-header\">%s</h2>\n"
 60+        "<details><summary>%s</summary>\n"
 61 
 62         "<div class=\"snac-user-setup\">\n" /** user setup **/
 63         "<form autocomplete=\"off\" method=\"post\" "
 64@@ -490,6 +484,7 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
 65         "</form>\n"
 66 
 67         "</div>\n"
 68+        "</details>\n"
 69         "</div>\n"
 70         "</div>\n";
 71 
 72@@ -535,7 +530,6 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
 73     xs *es6 = encode_html(purge_days);
 74 
 75     xs *s1 = xs_fmt(_tmpl,
 76-        settings ? "style=\"display: none\"" : "",
 77         L("New Post..."),
 78         L("Sensitive content"),
 79         L("Sensitive content description"),
 80@@ -555,15 +549,11 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
 81 
 82         L("Post"),
 83 
 84-        settings ? "style=\"display: none\"" : "",
 85         L("Operations..."),
 86-
 87         L("Follow"), L("(by URL or user@host)"),
 88         L("Boost"), L("(by URL)"),
 89 
 90-        !settings ? "style=\"display: none\"" : "",
 91-
 92-        L("User Settings"),
 93+        L("User Settings..."),
 94         L("Display name"),
 95         es1,
 96         L("Avatar"),
 97@@ -1380,7 +1370,7 @@ xs_str *html_timeline(snac *snac, const xs_list *list, int local, int skip, int
 98     s = html_user_header(snac, s, local);
 99 
100     if (!local)
101-        s = html_top_controls(snac, s, list == NULL ? 1 : 0);
102+        s = html_top_controls(snac, s);
103 
104     s = xs_str_cat(s, "<a name=\"snac-posts\"></a>\n");
105     s = xs_str_cat(s, "<div class=\"snac-posts\">\n");
106@@ -1817,18 +1807,6 @@ int html_get_handler(const xs_dict *req, const char *q_path,
107         }
108     }
109     else
110-    if (strcmp(p_path, "settings") == 0) { /** user settings **/
111-        if (!login(&snac, req)) {
112-            *body  = xs_dup(uid);
113-            status = 401;
114-        }
115-        else {
116-            *body   = html_timeline(&snac, NULL, 0, 0, 0, 0);
117-            *b_size = strlen(*body);
118-            status  = 200;
119-        }
120-    }
121-    else
122     if (strcmp(p_path, "notifications") == 0) { /** the list of notifications **/
123         if (!login(&snac, req)) {
124             *body  = xs_dup(uid);