summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/html.c b/html.c
index 56b0dee..e06a82f 100644
--- a/html.c
+++ b/html.c
@@ -920,8 +920,9 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
920 else { 920 else {
921 /* poll still active */ 921 /* poll still active */
922 xs *s1 = xs_fmt("<form method=\"post\" action=\"%s/admin/vote\">\n" 922 xs *s1 = xs_fmt("<form method=\"post\" action=\"%s/admin/vote\">\n"
923 "<input type=\"hidden\" name=\"actor\" value= \"%s\">\n"
923 "<input type=\"hidden\" name=\"irt\" value=\"%s\">\n", 924 "<input type=\"hidden\" name=\"irt\" value=\"%s\">\n",
924 snac->actor, id); 925 snac->actor, actor, id);
925 926
926 while (xs_list_iter(&p, &v)) { 927 while (xs_list_iter(&p, &v)) {
927 const char *name = xs_dict_get(v, "name"); 928 const char *name = xs_dict_get(v, "name");
@@ -1954,6 +1955,25 @@ int html_post_handler(const xs_dict *req, const char *q_path,
1954 1955
1955 status = 303; 1956 status = 303;
1956 } 1957 }
1958 else
1959 if (p_path && strcmp(p_path, "admin/vote") == 0) { /** **/
1960 char *irt = xs_dict_get(p_vars, "irt");
1961 const char *opt = xs_dict_get(p_vars, "question");
1962 const char *actor = xs_dict_get(p_vars, "actor");
1963
1964 xs *msg = msg_note(&snac, "", actor, irt, NULL, 1);
1965
1966 /* set the option */
1967 msg = xs_dict_append(msg, "name", opt);
1968
1969 xs *c_msg = msg_create(&snac, msg);
1970
1971 enqueue_message(&snac, c_msg);
1972
1973 timeline_add(&snac, xs_dict_get(msg, "id"), msg);
1974
1975 status = 303;
1976 }
1957 1977
1958 if (status == 303) { 1978 if (status == 303) {
1959 char *redir = xs_dict_get(p_vars, "redir"); 1979 char *redir = xs_dict_get(p_vars, "redir");