summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-05-29 09:12:19 +0200
committerGravatar default2023-05-29 09:12:19 +0200
commit32ce1fb28e5ce4a80c3b87573ce521df6ee0b042 (patch)
treeaa49664b568f59fd4a5a021c629f59254f31086b
parentNew macro ISO_DATE_SPEC. (diff)
downloadsnac2-32ce1fb28e5ce4a80c3b87573ce521df6ee0b042.tar.gz
snac2-32ce1fb28e5ce4a80c3b87573ce521df6ee0b042.tar.xz
snac2-32ce1fb28e5ce4a80c3b87573ce521df6ee0b042.zip
Close the question over due date in update_question().
-rw-r--r--activitypub.c10
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)
1038 /* update the list */ 1038 /* update the list */
1039 msg = xs_dict_set(msg, xs_dict_get(msg, "oneOf") != NULL ? "oneOf" : "anyOf", nopts); 1039 msg = xs_dict_set(msg, xs_dict_get(msg, "oneOf") != NULL ? "oneOf" : "anyOf", nopts);
1040 1040
1041 /* due date? */
1042 const char *end_time = xs_dict_get(msg, "endTime");
1043 if (!xs_is_null(end_time)) {
1044 xs *now = xs_str_utctime(0, ISO_DATE_SPEC);
1045
1046 /* it's now greater than the endTime? */
1047 if (strcmp(now, end_time) > 0)
1048 msg = xs_dict_set(msg, "closed", end_time);
1049 }
1050
1041 /* store */ 1051 /* store */
1042 object_add_ow(id, msg); 1052 object_add_ow(id, msg);
1043 1053