Disallow updating closed polls.

This commit is contained in:
default 2023-05-29 09:20:37 +02:00
parent 22fea17255
commit 60ea9b3a09

View file

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