Closed wjk36 closed 2 years ago
Thank you @wjk36, this is an obvious bug I should have seen earlier! To fix it, we need to add another validator in the respective forms in the draftpoll and addoption-dialog components, plus corresponding error messages.
It is a start; added a custom validator, in its own file since it should be used in the addoption-dialog too. But haven't wrapped my head around that component, when is it used?
Other opinions?
Edit: saw that the addoption-dialog is for adding options after the poll has started. Unfortunately this component seems to not know about the added options array.
I managed to add the validator also to addoption-dialog now, using: unique_name_validator$(of(this.p.oids.map(oid => this.p.options[oid].name)))
Currently user can enter the same option twice for the same poll. Maybe display a warning and disable 'ready' button when two options are non-unique.