mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
Fixed voting / replying confusion.
This commit is contained in:
parent
09e0d99251
commit
262de20aa8
3
data.c
3
data.c
@ -2009,7 +2009,8 @@ int was_question_voted(snac *user, const char *id)
|
|||||||
xs *obj = NULL;
|
xs *obj = NULL;
|
||||||
|
|
||||||
if (valid_status(object_get_by_md5(md5, &obj))) {
|
if (valid_status(object_get_by_md5(md5, &obj))) {
|
||||||
if (strcmp(xs_dict_get(obj, "attributedTo"), user->actor) == 0) {
|
if (strcmp(xs_dict_get(obj, "attributedTo"), user->actor) == 0 &&
|
||||||
|
!xs_is_null(xs_dict_get(obj, "name"))) {
|
||||||
voted = 1;
|
voted = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
18
html.c
18
html.c
@ -985,21 +985,9 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
|
|||||||
else
|
else
|
||||||
if (xs_startswith(id, snac->actor))
|
if (xs_startswith(id, snac->actor))
|
||||||
closed = 1; /* we questioned; closed for us */
|
closed = 1; /* we questioned; closed for us */
|
||||||
else {
|
else
|
||||||
/* not yet closed? check if we already voted for this */
|
if (was_question_voted(snac, id))
|
||||||
xs *children = object_children(id);
|
closed = 1; /* we already voted; closed for us */
|
||||||
p = children;
|
|
||||||
while (!closed && xs_list_iter(&p, &v)) {
|
|
||||||
xs *msg = NULL;
|
|
||||||
|
|
||||||
if (valid_status(object_get_by_md5(v, &msg))) {
|
|
||||||
const char *atto = xs_dict_get(msg, "attributedTo");
|
|
||||||
|
|
||||||
if (atto && strcmp(atto, snac->actor) == 0)
|
|
||||||
closed = 1; /* we already voted; closed for us */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the appropriate list of options */
|
/* get the appropriate list of options */
|
||||||
p = oo != NULL ? oo : ao;
|
p = oo != NULL ? oo : ao;
|
||||||
|
Loading…
Reference in New Issue
Block a user