summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-05-05 01:58:27 +0200
committerdefault <nobody@localhost>2024-05-05 01:58:27 +0200
commitbe9cf2f5550f68ef4e86b547d7247a0bd498521d (patch)
tree107681587a33ea0cc61cb1ac2793abec71a0a522
parentfc76ae4e9e721a1ec5fbcf3b509d5a47cf48cd61 (diff)
Enqueue an object request for closed polls.
It seems that Pleroma does not send poll updates on close (or never).
-rw-r--r--data.c2
-rw-r--r--html.c19
2 files changed, 20 insertions, 1 deletions
diff --git a/data.c b/data.c
index 4d753a9..b9c1141 100644
--- a/data.c
+++ b/data.c
@@ -2662,7 +2662,7 @@ void enqueue_object_request(snac *user, const char *id, int forward_secs)
qmsg = _enqueue_put(fn, qmsg);
- snac_debug(user, 0, xs_fmt("enqueue_object_request %s", id));
+ snac_debug(user, 0, xs_fmt("enqueue_object_request %s %d", id, forward_secs));
}
diff --git a/html.c b/html.c
index 45c665c..9de1cca 100644
--- a/html.c
+++ b/html.c
@@ -3300,6 +3300,25 @@ int html_post_handler(const xs_dict *req, const char *q_path,
timeline_add(&snac, xs_dict_get(msg, "id"), msg);
}
+ {
+ /* get the poll object */
+ xs *poll = NULL;
+
+ if (valid_status(object_get(irt, &poll))) {
+ char *date = xs_dict_get(poll, "endTime");
+ if (xs_is_null(date))
+ date = xs_dict_get(poll, "closed");
+
+ if (!xs_is_null(date)) {
+ time_t t = xs_parse_iso_date(date, 0) - time(NULL);
+
+ /* request the poll when it's closed;
+ Pleroma does not send and update when the poll closes */
+ enqueue_object_request(&snac, irt, t + 2);
+ }
+ }
+ }
+
status = 303;
}