Repository navigation
Prevent duplicate submissions on Request a Copy and grant/deny email forms - #6548
Open
chavananand wants to merge 1 commit into
Open
chavananand wants to merge 1 commit into
chavananand wants to merge 1 commit into
Conversation
…d grant/deny flows Repeated clicks on the "Request copy" button and on the "Send" button of the grant and deny email forms fired one REST request per click, creating duplicate item requests and duplicate notification emails. Guard each submit with an in-flight flag, disable the button and show a spinner while the request is pending, and re-enable it when the request fails so the user can retry. Fixes DSpace#6541
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
References
Description
Prevents duplicate item requests and duplicate emails when the "Request copy" button, or the "Send" button on the grant/deny email forms, is clicked repeatedly while the request is still in flight.
Instructions for Reviewers
List of changes in this PR:
BitstreamRequestACopyPageComponent: added asubmittingflag.onSubmit()returns early while a request is pending (or the form is invalid); the "Request copy" button is disabled and shows a spinner while submitting. The flag is reset on failure so the user can retry.GrantRequestCopyComponent/DenyRequestCopyComponent: added asendingflag with the same guard ingrant()/deny(), reset on failure.EmailRequestCopyComponent(and its themed wrapper): newsendinginput. While sending,submit()does nothing, the "Send" and "Back" buttons are disabled, and "Send" shows a spinner.bitstream-request-a-copy.submitting,grant-deny-request-copy.email.sending.How to test:
POST /server/api/core/itemrequestsshould be sent, and the button should show a spinner and be disabled until the redirect.Question for reviewers (from the issue discussion): should there also be a backend safeguard in DSpace/DSpace, such as deduplicating identical item requests within a short window, or is the UI in-flight guard sufficient?
AI Disclosure (REQUIRED)
Per our AI Contribution Policy, all contributors to DSpace MUST disclose AI/LLM usage.
This information helps reviewers assess provenance, licensing, security, and the level of verification needed.
If AI tools were ONLY used for incidental assistance (such as spelling/grammar correction, variable auto-completion, or translation), then select 'No'.
Were AI tools used in the creation of this PR?
If "Yes", briefly describe what portion of this PR was generated or assisted by AI. Additionally, tell us how you've verified the AI output aligns with DSpace's coding standards and is secure and accurate.
An AI coding assistant helped draft parts of the patch and the new specs. All changes were reviewed; ESLint reports no errors on the changed files, the affected specs pass locally, and the new in-flight specs were confirmed to fail when the guard is removed.
Checklist
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.