Просмотр исходного кода

post_langs can now be set from the user settings.

grunfink 11 месяцев назад
Родитель
Сommit
40592fb3d4
1 измененных файлов с 12 добавлено и 0 удалено
  1. 12 0
      html.c

+ 12 - 0
html.c

@@ -1346,6 +1346,7 @@ xs_html *html_top_controls(snac *user)
     const char *latitude     = xs_dict_get_def(user->config, "latitude", "");
     const char *longitude    = xs_dict_get_def(user->config, "longitude", "");
     const char *webhook      = xs_dict_get_def(user->config, "notify_webhook", "");
+    const char *post_langs   = xs_dict_get_def(user->config, "post_langs", "");
 
     xs *metadata = NULL;
     const xs_dict *md = xs_dict_get(user->config, "metadata");
@@ -1621,6 +1622,15 @@ xs_html *html_top_controls(snac *user)
                     xs_html_sctag("br", NULL),
                     tz_select),
 
+                xs_html_tag("p",
+                    xs_html_text(L("Languages you usually post in:")),
+                    xs_html_sctag("br", NULL),
+                    xs_html_sctag("input",
+                        xs_html_attr("type", "next"),
+                        xs_html_attr("name", "post_langs"),
+                        xs_html_attr("value", post_langs),
+                        xs_html_attr("placeholder", L("en fr es de_AT")))),
+
                 xs_html_tag("p",
                     xs_html_text(L("New password:")),
                     xs_html_sctag("br", NULL),
@@ -4924,6 +4934,8 @@ int html_post_handler(const xs_dict *req, const char *q_path,
             snac.config = xs_dict_set(snac.config, "lang", v);
         if ((v = xs_dict_get(p_vars, "tz")) != NULL)
             snac.config = xs_dict_set(snac.config, "tz", v);
+        if ((v = xs_dict_get(p_vars, "post_langs")) != NULL)
+            snac.config = xs_dict_set(snac.config, "post_langs", v);
 
         snac.config = xs_dict_set(snac.config, "latitude", xs_dict_get_def(p_vars, "latitude", ""));
         snac.config = xs_dict_set(snac.config, "longitude", xs_dict_get_def(p_vars, "longitude", ""));