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

🐛 PDF Backend Allows Creation of Multiple Active Poll #2507

Open
kneerose opened this issue Dec 11, 2024 · 0 comments
Open

🐛 PDF Backend Allows Creation of Multiple Active Poll #2507

kneerose opened this issue Dec 11, 2024 · 0 comments
Assignees
Labels
🐛 Bug Something isn't working 📜 Proposal Pillar

Comments

@kneerose
Copy link
Contributor

Area

Proposal Pillar

Domain

dev-sanchogov.tools

Which wallet were you using?

No response

Context

The current API permits the creation of new polls even when an existing poll remains active. As a result, multiple polls can be created for the same proposal without restriction. This issue also causes the "Close" button to appear multiple times, one for each poll, leading to UI inconsistencies and potentially conflicting poll states.

https://www.loom.com/share/19f879a3df854c879c1d9ff7277fb5de?sid=de71a437-ade5-4050-987e-8d3605cd223c

Steps to reproduce

  1. Connect the wallet.
  2. Create a proposal.
  3. Navigate to the created proposal.
  4. Add a poll using the interface.
  5. Copy the poll request from the network tab and execute it as a CURL command.
  6. Observe that additional polls can still be created, even if a poll for the same proposal is already active.

Actual behavior

  • The API allows multiple polls to be created for the same proposal, even when a poll is already active.
  • Each created poll results in a duplicate "Close" button in the UI.

Expected behavior

  • The API should enforce a restriction to prevent new poll creation for proposals that already have an active poll.
  • Only one active poll should exist for a proposal at any given time.

###Sample CURL Request

curl 'https://api.example.com/polls' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'authorization: Bearer <token>' \
  -H 'content-type: application/json' \
  --data-raw '{"data":{"proposal_id":"2784","poll_start_dt":"2024-12-11T04:29:14.194Z","is_poll_active":true}}'

APi Response

{
  "data": {
    "id": 595,
    "attributes": {
      "proposal_id": "2784",
      "poll_yes": 0,
      "poll_no": 0,
      "poll_start_dt": "2024-12-11T04:29:14.194Z",
      "is_poll_active": true,
      "createdAt": "2024-12-11T04:29:27.250Z",
      "updatedAt": "2024-12-11T04:29:27.250Z"
    }
  },
  "meta": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working 📜 Proposal Pillar
Projects
Status: No status
Status: To do
Development

No branches or pull requests

3 participants