commit 262de20

default  ·  2023-06-15 15:24:44 +0000 UTC
parent 09e0d99
Fixed voting / replying confusion.
2 files changed,  +5, -16
M data.c
M html.c
M data.c
+2, -1
 1@@ -2009,7 +2009,8 @@ int was_question_voted(snac *user, const char *id)
 2         xs *obj = NULL;
 3 
 4         if (valid_status(object_get_by_md5(md5, &obj))) {
 5-            if (strcmp(xs_dict_get(obj, "attributedTo"), user->actor) == 0) {
 6+            if (strcmp(xs_dict_get(obj, "attributedTo"), user->actor) == 0 &&
 7+                !xs_is_null(xs_dict_get(obj, "name"))) {
 8                 voted = 1;
 9                 break;
10             }
M html.c
+3, -15
 1@@ -985,21 +985,9 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
 2             else
 3             if (xs_startswith(id, snac->actor))
 4                 closed = 1; /* we questioned; closed for us */
 5-            else {
 6-                /* not yet closed? check if we already voted for this */
 7-                xs *children = object_children(id);
 8-                p = children;
 9-                while (!closed && xs_list_iter(&p, &v)) {
10-                    xs *msg = NULL;
11-
12-                    if (valid_status(object_get_by_md5(v, &msg))) {
13-                        const char *atto = xs_dict_get(msg, "attributedTo");
14-
15-                        if (atto && strcmp(atto, snac->actor) == 0)
16-                            closed = 1; /* we already voted; closed for us */
17-                    }
18-                }
19-            }
20+            else
21+            if (was_question_voted(snac, id))
22+                closed = 1; /* we already voted; closed for us */
23 
24             /* get the appropriate list of options */
25             p = oo != NULL ? oo : ao;