commit fc6a975

default  ·  2025-02-14 08:23:56 +0000 UTC
parent 26d0f5c
More variable renaming.
1 files changed,  +26, -26
M html.c
M html.c
+26, -26
  1@@ -1091,16 +1091,16 @@ static xs_html *html_user_body(snac *user, int read_only)
  2 }
  3 
  4 
  5-xs_html *html_top_controls(snac *snac)
  6+xs_html *html_top_controls(snac *user)
  7 /* generates the top controls */
  8 {
  9-    xs *ops_action = xs_fmt("%s/admin/action", snac->actor);
 10+    xs *ops_action = xs_fmt("%s/admin/action", user->actor);
 11 
 12     xs_html *top_controls = xs_html_tag("div",
 13         xs_html_attr("class", "snac-top-controls"),
 14 
 15         /** new post **/
 16-        html_note(snac, L("New Post..."),
 17+        html_note(user, L("New Post..."),
 18             "new_post_div", "new_post_form",
 19             L("What's on your mind?"), "",
 20             NULL, NULL,
 21@@ -1170,53 +1170,53 @@ xs_html *html_top_controls(snac *snac)
 22     const char *email = "[disabled by admin]";
 23 
 24     if (xs_type(xs_dict_get(srv_config, "disable_email_notifications")) != XSTYPE_TRUE) {
 25-        email = xs_dict_get(snac->config_o, "email");
 26+        email = xs_dict_get(user->config_o, "email");
 27         if (xs_is_null(email)) {
 28-            email = xs_dict_get(snac->config, "email");
 29+            email = xs_dict_get(user->config, "email");
 30 
 31             if (xs_is_null(email))
 32                 email = "";
 33         }
 34     }
 35 
 36-    const char *cw = xs_dict_get(snac->config, "cw");
 37+    const char *cw = xs_dict_get(user->config, "cw");
 38     if (xs_is_null(cw))
 39         cw = "";
 40 
 41-    const char *telegram_bot = xs_dict_get(snac->config, "telegram_bot");
 42+    const char *telegram_bot = xs_dict_get(user->config, "telegram_bot");
 43     if (xs_is_null(telegram_bot))
 44         telegram_bot = "";
 45 
 46-    const char *telegram_chat_id = xs_dict_get(snac->config, "telegram_chat_id");
 47+    const char *telegram_chat_id = xs_dict_get(user->config, "telegram_chat_id");
 48     if (xs_is_null(telegram_chat_id))
 49         telegram_chat_id = "";
 50 
 51-    const char *ntfy_server = xs_dict_get(snac->config, "ntfy_server");
 52+    const char *ntfy_server = xs_dict_get(user->config, "ntfy_server");
 53     if (xs_is_null(ntfy_server))
 54         ntfy_server = "";
 55 
 56-    const char *ntfy_token = xs_dict_get(snac->config, "ntfy_token");
 57+    const char *ntfy_token = xs_dict_get(user->config, "ntfy_token");
 58     if (xs_is_null(ntfy_token))
 59         ntfy_token = "";
 60 
 61-    const char *purge_days = xs_dict_get(snac->config, "purge_days");
 62+    const char *purge_days = xs_dict_get(user->config, "purge_days");
 63     if (!xs_is_null(purge_days) && xs_type(purge_days) == XSTYPE_NUMBER)
 64         purge_days = (char *)xs_number_str(purge_days);
 65     else
 66         purge_days = "0";
 67 
 68-    const xs_val *d_dm_f_u  = xs_dict_get(snac->config, "drop_dm_from_unknown");
 69-    const xs_val *bot       = xs_dict_get(snac->config, "bot");
 70-    const xs_val *a_private = xs_dict_get(snac->config, "private");
 71-    const xs_val *auto_boost = xs_dict_get(snac->config, "auto_boost");
 72-    const xs_val *coll_thrds = xs_dict_get(snac->config, "collapse_threads");
 73-    const xs_val *pending    = xs_dict_get(snac->config, "approve_followers");
 74-    const xs_val *show_foll  = xs_dict_get(snac->config, "show_contact_metrics");
 75-    const char *latitude     = xs_dict_get_def(snac->config, "latitude", "");
 76-    const char *longitude    = xs_dict_get_def(snac->config, "longitude", "");
 77+    const xs_val *d_dm_f_u  = xs_dict_get(user->config, "drop_dm_from_unknown");
 78+    const xs_val *bot       = xs_dict_get(user->config, "bot");
 79+    const xs_val *a_private = xs_dict_get(user->config, "private");
 80+    const xs_val *auto_boost = xs_dict_get(user->config, "auto_boost");
 81+    const xs_val *coll_thrds = xs_dict_get(user->config, "collapse_threads");
 82+    const xs_val *pending    = xs_dict_get(user->config, "approve_followers");
 83+    const xs_val *show_foll  = xs_dict_get(user->config, "show_contact_metrics");
 84+    const char *latitude     = xs_dict_get_def(user->config, "latitude", "");
 85+    const char *longitude    = xs_dict_get_def(user->config, "longitude", "");
 86 
 87     xs *metadata = NULL;
 88-    const xs_dict *md = xs_dict_get(snac->config, "metadata");
 89+    const xs_dict *md = xs_dict_get(user->config, "metadata");
 90 
 91     if (xs_type(md) == XSTYPE_DICT) {
 92         const xs_str *k;
 93@@ -1238,7 +1238,7 @@ xs_html *html_top_controls(snac *snac)
 94     else
 95         metadata = xs_str_new(NULL);
 96 
 97-    xs *user_setup_action = xs_fmt("%s/admin/user-setup", snac->actor);
 98+    xs *user_setup_action = xs_fmt("%s/admin/user-setup", user->actor);
 99 
100     xs_html_add(top_controls,
101         xs_html_tag("details",
102@@ -1257,7 +1257,7 @@ xs_html *html_top_controls(snac *snac)
103                     xs_html_sctag("input",
104                         xs_html_attr("type", "text"),
105                         xs_html_attr("name", "name"),
106-                        xs_html_attr("value", xs_dict_get(snac->config, "name")),
107+                        xs_html_attr("value", xs_dict_get(user->config, "name")),
108                         xs_html_attr("placeholder", L("Your name")))),
109                 xs_html_tag("p",
110                     xs_html_text(L("Avatar: ")),
111@@ -1287,7 +1287,7 @@ xs_html *html_top_controls(snac *snac)
112                         xs_html_attr("cols", "40"),
113                         xs_html_attr("rows", "4"),
114                         xs_html_attr("placeholder", L("Write about yourself here...")),
115-                        xs_html_text(xs_dict_get(snac->config, "bio")))),
116+                        xs_html_text(xs_dict_get(user->config, "bio")))),
117                 xs_html_sctag("input",
118                     xs_html_attr("type", "checkbox"),
119                     xs_html_attr("name", "cw"),
120@@ -1450,8 +1450,8 @@ xs_html *html_top_controls(snac *snac)
121 
122                 xs_html_tag("p", NULL)))));
123 
124-    xs *followed_hashtags_action = xs_fmt("%s/admin/followed-hashtags", snac->actor);
125-    xs *followed_hashtags = xs_join(xs_dict_get_def(snac->config,
126+    xs *followed_hashtags_action = xs_fmt("%s/admin/followed-hashtags", user->actor);
127+    xs *followed_hashtags = xs_join(xs_dict_get_def(user->config,
128                         "followed_hashtags", xs_stock(XSTYPE_LIST)), "\n");
129 
130     xs_html_add(top_controls,