GN-4430: Don't allow editing agendapoint participants if votings are present #564
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Originally, it was always possible to edit the participants in an agendapoint. However, the votings attached are closely related: only present participants can vote. When creating a vote and then changing the participants, this would create a mismatch between both.
In most cases this gave no bugs, except for the voting making less sense.
In the case of removing all participants after adding votes, the votes would be hidden, but still exist. This means that when publishing, the voting would suddenly pop up again. This is the bug mentioned in the ticket.
This fixes this by not allowing participants changes for an agendapoint that has votings.
connected issues and PRs:
https://binnenland.atlassian.net/browse/GN-4430
How to test/reproduce
Getting the bug of a vote showing up when there are no votes in the edit page:
For an agenda:
Besides this being "fixed", you should check that you can never change participants for agendaitems that have a voting.
Challenges/uncertainties
It was hard to figure out how to show this info without even more "warning" popups.
I decided that a disabled button with explanation text was the most clean. It does not scream attention, but will be read if someone is confused, as it is located on the button that disappears.
Note that a disabled button is used purely for the css looks. The disabled button has no code attached to it. Not sure if this is the cleanest way, but it was the most straightforward (and hence easiest+most clear).