Generated with the help of an LLM.
Problem/Motivation
"Mark as reviewed" (the form, the bulk action on the dashboard and the MarkReviewedAction) always passes a next review date to ReviewedDateManager::markAsReviewed(): the date chosen in the form, which defaults to today + the review period. That date is stored as an explicit next review date, even when the editor didn't change it.
From then on the stored date wins over the review period:
- A later edit records a review, but keeps the stored next date. So a page edited 11 months after it was marked is due again a month later, instead of a year after the edit.
- When an administrator changes the review period of a content type, nodes that were marked keep their old due date.
That doesn't seem to be the intention, as the field description says "Optional. A specific date for the next review, instead of the usual @days days."
Steps to reproduce
- Track a content type with a review period of 365 days.
- Mark a node as reviewed without changing "Review again on".
- Check
content_review_next_dateon the node: it holds today + 365 days. - Change the review period to 180 days. The node is still due in 365 days.
Proposed resolution
In markAsReviewed(), treat a next review date equal to the review date + the review period as "no specific date": store none, so the period applies. Only a date that differs from that is stored.
Remaining tasks
- Review.
- Test coverage.
User interface changes
None.
API changes
markAsReviewed() clears the stored next review date when the given one equals the period default.
Data model changes
None.
Issue fork content_reviewed_date-3636482
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:
- 3636482-mark-reviewed-default-next-date
changes, plain diff MR !3
Comments
Comment #3
svendecabooterComment #4
svendecabooterCreated a MR.
markAsReviewed()now stores no next review date when the given one equals the review date + the period, so it fixes the form, the bulk action and the action plugin in one place.Added a unit test for that case.
testDashboardAndPermissionsasserted the old behaviour after bulk marking (an explicit date of today + 365 days), so it now checks that no date is stored and the node is not stale.phpcs, phpstan (level max) and the full test suite pass locally on Drupal 11.4.
Comment #6
ajetiv1