verbb / workflow

A Craft CMS plugin to create a workflow for publishing entries.
Other
140 stars 28 forks source link

Approved submissions appear as pending when approver user is deleted #219

Open Aku-benj opened 1 month ago

Aku-benj commented 1 month ago

Describe the bug

When a user who has approved a worflow submission is deleted from the system, even if the transfert data to another user is used, the worflow approved actions are deleted. This put all old approved submission by this user in pending state but the entries are still published.

When the approver user is in the trash it looks like : image And then once cleaned the approved action is simply deleted: image

tested with multiple entries and submission, that's why the date dont match in screenshots.

What's your proposed solution?

Find a way to reassign the workflow_reviews (actions) to the selected user if choosed during the user deletion process. Or simple put NULL in the userId column of table workflow_reviews, seems to work without errors.

Steps to reproduce

  1. Create 3 users, first for the creation of submission and second one for the approbation, and one admin
  2. Create a submission with user one
  3. Approve it with second user
  4. Delete the approver user
  5. Empty trash of deleted users
  6. Check the previously approved submission

Craft CMS version

4.12.7

Plugin version

2.0.12

Multi-site?

Yes

Additional context

This is happening in all environments

engram-design commented 1 month ago

Yep, probably an oversight on my part that was CASCADE reviews when the owner user is deleted.

Fixed for the next release. To get this early, run composer require verbb/workflow:"dev-craft-4 as 2.0.12".

I'll also investigate hooking into the user content transfer process to properly handle this as you'd expect when deleting a user.

Aku-benj commented 1 month ago

Thanks a lot for the fast reply and the proposed fix. I will only have time to test it next week.