Repository navigation
feat(actions): require a comment when declining a request - #651
Open
zubeydecivelek wants to merge 1 commit into
Open
zubeydecivelek wants to merge 1 commit into
zubeydecivelek wants to merge 1 commit into
Conversation
Contributor
Author
|
With frontend changes - disable the button****With frontend changes - disable the button Screen.Recording.2026-11-18.at.12.19.50.mov |
Contributor
Author
|
Only validate from backend - button stays same Screen.Recording.2026-11-18.at.13.09.59.mov |
Contributor
Author
|
Refresh the modal - it keeps the previous text Screen.Recording.2026-11-18.at.13.26.27.mov |
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.
closes CERNDocumentServer/cds-rdm#1040
❤️ Thank you for your contribution!
Description
Declining a request now requires a non-blank comment, so the creator always gets a reason. Other actions are unchanged.
New
RequestAction.comment_requiredattribute. It defaults toFalseand is set toTrueonDeclineAction, so every decline action that inherits from it requires a comment.RequestsService.execute_actionrejects a required-comment action whosepayload.contentis missing or blank (HTML is stripped, so<p><br></p>counts as blank). The error isCannotExecuteActionError, returned as HTTP 400, and the request status is unchanged.User moderation ("Block user").
DeclineUserActionsetscomment_required = False, because the administration panel blocks users without a comment.System processes. Identities providing
system_processcan still decline without a comment.The decline modal shows "Add comment (required)", and the Decline button stays disabled until a non-blank comment is entered. User moderation keeps "(optional)".
The editor now updates the comment on every keystroke (
onEditorChangeinstead ofonChange). This keeps the button state in sync with what is typed.The comment is cleared each time the action modal is opened. Before, text from a cancelled modal was still sent with the next action.
RequestActionButtonandRequestDeclineButtonaccept an optionaldisabledprop, defaulting tofalse.Behaviour change for API clients. Requests to
POST /api/requests/<id>/actions/declinewithout a comment now get a 400. That includes downstream test suites (rdm-records, communities). Affected types include community submission and inclusion, record deletion, access requests, community invitations and membership requests.Locked requests (
REQUESTS_LOCKING_ENABLED = True). Only users allowed to comment on a locked request (administrators) can decline it, because the required comment cannot be created otherwise.Checklist
Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:
Frontend
Reminder
By using GitHub, you have already agreed to the GitHub’s Terms of Service including that: