Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A voter can enter the voting booth even if the election isn't setup #317

Open
andreslucena opened this issue May 19, 2023 · 3 comments
Open
Assignees

Comments

@andreslucena
Copy link
Member

andreslucena commented May 19, 2023

Describe the bug

Given that I'm a registered user and there is an Election created and this election is configured with an start_date of yesterday and an end_date of tomorrow, then I can enter to the voting booth even though this Election isn't setup (sent to the BB). It should check if the Election is at least blocked.

The same happens if the election is configured with an end_date of yesterday.

To Reproduce

  1. Sign in as admin
  2. Configure an Election with an start_date of yesterday and an end_date of tomorrow
  3. Go to the frontend view
  4. Click on the "Start voting" button

See that there's a somewhat cryptic modal error that it couldn't find the election

Expected behavior

It should not show the button
It should not allow entering by the URL

Screenshots

Selection_614

Stacktrace

In the console there's this error:

TypeError: (intermediate value).data.election is null

Extra data

  • Decidim Version: 0.28.0.dev

Additional context

No response

@greenwoodt greenwoodt self-assigned this May 23, 2023
@andreslucena
Copy link
Member Author

@greenwoodt a couple pointers regarding this one:

I think this is related with decidim/decidim#10903, as it's allowing to vote because the Election is ongoing, but in the case of decidim-elections there's an external system (Bulletin Board). We should take into account this condition: it must be possible to vote only if the Election was sent to the BB, so it must be blocked. I don't know if its enough with changing this line https://github.com/decidim/decidim/blob/43a2c9cf6b9e3a9e72c0b16a06e9218b2fa42ccc/decidim-elections/app/permissions/decidim/elections/permissions.rb#L38 with something like

election.published? && election.ongoing? && election.blocked?

Another thing that could be wrong is this check in the cell view:

https://github.com/decidim/decidim/blob/43a2c9cf6b9e3a9e72c0b16a06e9218b2fa42ccc/decidim-elections/app/cells/decidim/elections/election_vote_cta/show.erb#L6

It should probably be

<% if model.ongoing? && model.blocked? %>

(This cell I found it out by reading the view: https://github.com/decidim/decidim/blob/43a2c9cf6b9e3a9e72c0b16a06e9218b2fa42ccc/decidim-elections/app/views/decidim/elections/elections/show.html.erb#LL50C9-L50C9)

@greenwoodt
Copy link

Let me look into it @andreslucena. Cheers

@greenwoodt
Copy link

As discussed, there seems to be another related issue to this where the publication button is unattainable as a admin now even when you create a new election.

@andreslucena andreslucena transferred this issue from decidim/decidim Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants