diff options
| author | 2023-05-30 06:37:09 +0200 | |
|---|---|---|
| committer | 2023-05-30 06:37:09 +0200 | |
| commit | 6e6fa934b5766c7a92c257262a9856c1a36d01fd (patch) | |
| tree | ade505a12d64cd8bfc1e84f782dd308dec39d697 /html.c | |
| parent | Moved "Closed" poll string to where it belongs. (diff) | |
| download | snac2-6e6fa934b5766c7a92c257262a9856c1a36d01fd.tar.gz snac2-6e6fa934b5766c7a92c257262a9856c1a36d01fd.tar.xz snac2-6e6fa934b5766c7a92c257262a9856c1a36d01fd.zip | |
Better poll close checks.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -899,10 +899,10 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, | |||
| 899 | int closed = 0; | 899 | int closed = 0; |
| 900 | 900 | ||
| 901 | if (xs_dict_get(msg, "closed")) | 901 | if (xs_dict_get(msg, "closed")) |
| 902 | closed = 1; | 902 | closed = 2; |
| 903 | else | 903 | else |
| 904 | if (xs_startswith(id, snac->actor)) | 904 | if (xs_startswith(id, snac->actor)) |
| 905 | closed = 1; /* we questioned? closed for us */ | 905 | closed = 1; /* we questioned; closed for us */ |
| 906 | else { | 906 | else { |
| 907 | /* not yet closed? check if we already voted for this */ | 907 | /* not yet closed? check if we already voted for this */ |
| 908 | xs *children = object_children(id); | 908 | xs *children = object_children(id); |
| @@ -914,7 +914,7 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, | |||
| 914 | const char *atto = xs_dict_get(msg, "attributedTo"); | 914 | const char *atto = xs_dict_get(msg, "attributedTo"); |
| 915 | 915 | ||
| 916 | if (atto && strcmp(atto, snac->actor) == 0) | 916 | if (atto && strcmp(atto, snac->actor) == 0) |
| 917 | closed = 1; /* closed for us */ | 917 | closed = 1; /* we already voted; closed for us */ |
| 918 | } | 918 | } |
| 919 | } | 919 | } |
| 920 | } | 920 | } |
| @@ -941,7 +941,7 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, | |||
| 941 | c = xs_str_cat(c, "</table>\n"); | 941 | c = xs_str_cat(c, "</table>\n"); |
| 942 | 942 | ||
| 943 | /* if it's *really* closed, say it */ | 943 | /* if it's *really* closed, say it */ |
| 944 | if (!xs_is_null(xs_dict_get(msg, "closed"))) { | 944 | if (closed == 2) { |
| 945 | xs *s1 = xs_fmt("<p>%s</p>\n", L("Closed")); | 945 | xs *s1 = xs_fmt("<p>%s</p>\n", L("Closed")); |
| 946 | c = xs_str_cat(c, s1); | 946 | c = xs_str_cat(c, s1); |
| 947 | } | 947 | } |