diff options
| author | 2023-05-29 11:07:38 +0200 | |
|---|---|---|
| committer | 2023-05-29 11:07:38 +0200 | |
| commit | 765936244888f8d5f1644b0178cc6dc70597166b (patch) | |
| tree | c7766c1c55748329f0cc4deda0e528bda6845d0c /activitypub.c | |
| parent | Keep the original question order after updates. (diff) | |
| download | snac2-765936244888f8d5f1644b0178cc6dc70597166b.tar.gz snac2-765936244888f8d5f1644b0178cc6dc70597166b.tar.xz snac2-765936244888f8d5f1644b0178cc6dc70597166b.zip | |
Enqueue a close_question user q_item.
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c index 27f9c7c..15937c3 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -1058,8 +1058,10 @@ int update_question(snac *user, const char *id) | |||
| 1058 | xs *now = xs_str_utctime(0, ISO_DATE_SPEC); | 1058 | xs *now = xs_str_utctime(0, ISO_DATE_SPEC); |
| 1059 | 1059 | ||
| 1060 | /* it's now greater than the endTime? */ | 1060 | /* it's now greater than the endTime? */ |
| 1061 | if (strcmp(now, end_time) > 0) | 1061 | if (strcmp(now, end_time) > 0) { |
| 1062 | msg = xs_dict_set(msg, "closed", end_time); | 1062 | xs *et = xs_dup(end_time); |
| 1063 | msg = xs_dict_set(msg, "closed", et); | ||
| 1064 | } | ||
| 1063 | } | 1065 | } |
| 1064 | 1066 | ||
| 1065 | /* update the count of voters */ | 1067 | /* update the count of voters */ |
| @@ -1541,6 +1543,14 @@ void process_user_queue_item(snac *snac, xs_dict *q_item) | |||
| 1541 | } | 1543 | } |
| 1542 | } | 1544 | } |
| 1543 | else | 1545 | else |
| 1546 | if (strcmp(type, "close_question") == 0) { | ||
| 1547 | /* the time for this question has ended */ | ||
| 1548 | const char *id = xs_dict_get(q_item, "message"); | ||
| 1549 | |||
| 1550 | if (!xs_is_null(id)) | ||
| 1551 | update_question(snac, id); | ||
| 1552 | } | ||
| 1553 | else | ||
| 1544 | snac_log(snac, xs_fmt("unexpected q_item type '%s'", type)); | 1554 | snac_log(snac, xs_fmt("unexpected q_item type '%s'", type)); |
| 1545 | } | 1555 | } |
| 1546 | 1556 | ||