diff options
author | default <nobody@localhost> | 2023-05-29 09:12:19 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2023-05-29 09:12:19 +0200 |
commit | 32ce1fb28e5ce4a80c3b87573ce521df6ee0b042 (patch) | |
tree | aa49664b568f59fd4a5a021c629f59254f31086b /activitypub.c | |
parent | 654e171b93f6fdc8c6a1a4b09e8cd4b2448617d0 (diff) |
Close the question over due date in update_question().
Diffstat (limited to 'activitypub.c')
-rw-r--r-- | activitypub.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activitypub.c b/activitypub.c index 6c8772d..2dfbf80 100644 --- a/activitypub.c +++ b/activitypub.c @@ -1038,6 +1038,16 @@ int update_question(snac *user, const char *id) /* update the list */ msg = xs_dict_set(msg, xs_dict_get(msg, "oneOf") != NULL ? "oneOf" : "anyOf", nopts); + /* due date? */ + const char *end_time = xs_dict_get(msg, "endTime"); + if (!xs_is_null(end_time)) { + xs *now = xs_str_utctime(0, ISO_DATE_SPEC); + + /* it's now greater than the endTime? */ + if (strcmp(now, end_time) > 0) + msg = xs_dict_set(msg, "closed", end_time); + } + /* store */ object_add_ow(id, msg); |