opengovsg / FormSG

Form builder for the Singapore Government
https://form.gov.sg
Other
260 stars 78 forks source link

feat: single submission per nric #7448

Closed kevin9foong closed 3 days ago

kevin9foong commented 2 weeks ago

Problem

For some forms, we want to limit the form submissions to a single submission per NRIC. (Eg, each unique voter can only cast 1 vote)

Closes FRM-1756

Solution

Implement single limit per nric flow.

Storybook test:

Unit tests:

Breaking Changes

Before & After Screenshots

Subject Before After
single submission per submitterId toggle image image
block user from seeing form if already submitted NA image
modal popup if user has accessed form and submitting twice from 2 diff browser, firefox/chrome or incognito/private mode NA image
toast error if user uses browser which share same cookie NA image

Tests

TC1: single submission per nric toggle is disabled/locked when payments is connected

TC2: payments cannot be connected when single submission per nric toggle is enabled, error message changes when both email notifications + single submission for storage mode

TC3: same nric can submit multiple times when isSingleSubmission is toggled off, does not affect other nric, same nric cannot submit once isSingleSubmission is toggled on (Remembers past submitterIds even before toggle is turned on).

TC4: if isSingleSubmission is toggled on from the start, same nric can only submit once.

TC5: if isSingleSubmission is toggled on from the start, different nric can submit

TC6: same nric cannot submit despite both logging in and having race condition, same browser

TC7: same nric cannot submit despite both logging in and having race condition, different browser

TC8: when admin turns on isSingleSubmission while prev submitter is resubmitting form

TC9: duplicate also retains the isSingleSubmission setting

linear[bot] commented 2 weeks ago

FRM-1756 One response per NRIC/FIN