Split out from #3521201 (MR !51) so that MR can focus on the global-flow fix.

Problem

On the policy edit form, we currently warn only for one of the two possible misconfigurations of the pre-deletion notification feature:

  • Blocked: the Users pre-notified only condition is active, but pre-deletion notifications are effectively disabled for the policy. No user is ever purged because the condition requires a prior notification that will never be recorded. Already warned (inline + on save).
  • Ungated: pre-deletion notifications are effectively enabled, but the Users pre-notified only condition is not active. The notification email is sent, but users may be purged before the notification delay has elapsed. Not warned today — an admin who disables the condition sees no indication that their purge is now ungated.

Proposed change

  1. Refactor hasNotificationConflict() into getNotificationInconsistency() returning 'blocked', 'ungated', or NULL. The two states are mutually exclusive and share the cascade resolution, so one method with a string return is cleaner than two bool detectors.
  2. Show an inline warning block inside the notification fieldset for both cases. Use messages--error for blocked (the policy will never purge anything) and messages--warning for ungated (the policy still works, just without gating).
  3. Flash the corresponding message on save via addError() / addWarning().
  4. Add policy-side functional test coverage in tests/src/Functional/policy/PolicyNotificationTest.php for pre-notification gating on the policy path (complement the global-path coverage that stays in #3521201).

Files touched

  • src/Form/PurgeUsersPolicyEditForm.php
  • tests/src/Functional/policy/PolicyNotificationTest.php (new)
  • .cspell-project-words.txt (adds "ungated")
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

  • mably committed bc2072c8 on 5.x
    feat: #3585858 Policy edit form: surface inconsistencies between pre-...
mably’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.