Skip to content

feat(actions): require a comment when declining a request - #651

Open
zubeydecivelek wants to merge 1 commit into
inveniosoftware:masterfrom
zubeydecivelek:decline
Open

zubeydecivelek wants to merge 1 commit into
inveniosoftware:masterfrom
zubeydecivelek:decline

Conversation

@zubeydecivelek

@zubeydecivelek zubeydecivelek commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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_required attribute. It defaults to False and is set to True on DeclineAction, so every decline action that inherits from it requires a comment.

  • RequestsService.execute_action rejects a required-comment action whose payload.content is missing or blank (HTML is stripped, so <p><br></p> counts as blank). The error is CannotExecuteActionError, returned as HTTP 400, and the request status is unchanged.

  • User moderation ("Block user"). DeclineUserAction sets comment_required = False, because the administration panel blocks users without a comment.

  • System processes. Identities providing system_process can 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 (onEditorChange instead of onChange). 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.

  • RequestActionButton and RequestDeclineButton accept an optional disabled prop, defaulting to false.

  • Behaviour change for API clients. Requests to POST /api/requests/<id>/actions/decline without 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:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

@zubeydecivelek

zubeydecivelek commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

With frontend changes - disable the button****With frontend changes - disable the button

Screen.Recording.2026-11-18.at.12.19.50.mov

@zubeydecivelek

Copy link
Copy Markdown
Contributor Author

Only validate from backend - button stays same

Screen.Recording.2026-11-18.at.13.09.59.mov

@zubeydecivelek

Copy link
Copy Markdown
Contributor Author

Refresh the modal - it keeps the previous text

Screen.Recording.2026-11-18.at.13.26.27.mov

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

Successfully merging this pull request may close these issues.

Issue: Notify the referee group when a committee-approval request is accepted/declined

1 participant