snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 60ea9b3a0989599fd05459ca12ca9158298c1065
parent 22fea1725536a51672c6d0ef5b26abc62ba4a1b2
Author: default <nobody@localhost>
Date:   Mon, 29 May 2023 09:20:37 +0200

Disallow updating closed polls.

Diffstat:
Mactivitypub.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/activitypub.c b/activitypub.c @@ -983,10 +983,14 @@ int update_question(snac *user, const char *id) if (!valid_status(object_get(id, &msg))) return -1; + /* closed? do nothing more */ + if (xs_dict_get(msg, "closed")) + return -2; + /* get the options */ if ((opts = xs_dict_get(msg, "oneOf")) == NULL && (opts = xs_dict_get(msg, "anyOf")) == NULL) - return -2; + return -3; /* fill the initial count */ p = opts;