summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.c3
-rw-r--r--html.c18
2 files changed, 5 insertions, 16 deletions
diff --git a/data.c b/data.c
index b943995..ad581ee 100644
--- a/data.c
+++ b/data.c
@@ -2009,7 +2009,8 @@ int was_question_voted(snac *user, const char *id)
2009 xs *obj = NULL; 2009 xs *obj = NULL;
2010 2010
2011 if (valid_status(object_get_by_md5(md5, &obj))) { 2011 if (valid_status(object_get_by_md5(md5, &obj))) {
2012 if (strcmp(xs_dict_get(obj, "attributedTo"), user->actor) == 0) { 2012 if (strcmp(xs_dict_get(obj, "attributedTo"), user->actor) == 0 &&
2013 !xs_is_null(xs_dict_get(obj, "name"))) {
2013 voted = 1; 2014 voted = 1;
2014 break; 2015 break;
2015 } 2016 }
diff --git a/html.c b/html.c
index ad8020d..b652064 100644
--- a/html.c
+++ b/html.c
@@ -985,21 +985,9 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
985 else 985 else
986 if (xs_startswith(id, snac->actor)) 986 if (xs_startswith(id, snac->actor))
987 closed = 1; /* we questioned; closed for us */ 987 closed = 1; /* we questioned; closed for us */
988 else { 988 else
989 /* not yet closed? check if we already voted for this */ 989 if (was_question_voted(snac, id))
990 xs *children = object_children(id); 990 closed = 1; /* we already voted; closed for us */
991 p = children;
992 while (!closed && xs_list_iter(&p, &v)) {
993 xs *msg = NULL;
994
995 if (valid_status(object_get_by_md5(v, &msg))) {
996 const char *atto = xs_dict_get(msg, "attributedTo");
997
998 if (atto && strcmp(atto, snac->actor) == 0)
999 closed = 1; /* we already voted; closed for us */
1000 }
1001 }
1002 }
1003 991
1004 /* get the appropriate list of options */ 992 /* get the appropriate list of options */
1005 p = oo != NULL ? oo : ao; 993 p = oo != NULL ? oo : ao;