Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually applying a draft or creating an entry from a draft leaves the submission in pending state #187

Open
MoritzLost opened this issue Apr 5, 2023 · 5 comments

Comments

@MoritzLost
Copy link

Describe the bug

When a publisher reviews a submission, they get the options to approve or reject the submission. Approving it will automatically apply the draft, or create an entry if it's an unpublished draft for a new entry. However, the publishers also have the regular buttons to apply the draft (or Create entry for unpublished drafts). Using those will leave the submission in Pending state. In this case, the interface for approving or rejecting the submission is still displayed:

Screenshot 2023-04-05 at 12 07 54

However, trying to approve or reject the submission will result in an error:

HTTP 400 – Bad Request – yii\web\BadRequestHttpException
No draft was identified by the request.

This makes sense, since the draft the submission was referencing doesn't exist any more. But from a user's perspective, this is an error and is hard to understand.

I think the best solution would be to automatically set the submission to Approved in this case. If the draft is manually applied, this means the submission was accepted, so this makes sense from the publisher's perspective. This would also mean that the email notification to the editor is sent as well, which is currently impossible, since the submission can't be approved once the draft has been applied.

Steps to reproduce

  1. As an editor, create a draft for a new entry and submit it.
  2. As the publisher, go to the draft and click on Create entry.
  3. After the entry is created, click on Approve and publish, this will cause the error mentioned above.

Craft CMS version

4.4.5

Plugin version

2.0.4

Multi-site?

No

Additional context

No response

@engram-design
Copy link
Member

Hmmm, it's a big assumption to make that if a draft that was linked to the submission that now doesn't exist means that it's been approved. But I suppose short of a draft being outright deleted, there's not too many other scenarios that could happen.

I'll give it some further thought.

@MoritzLost
Copy link
Author

@engram-design Can't this be done with entry save hooks? When an entry is saved, the plugin can hook into the save process and check if the draft being saved is associated with any pending submission and approve that submission. This leaves out any guesswork. Or am I missing something?

@engram-design
Copy link
Member

All of workflows actions are already on the save events, but only if they “opt in” to a workflow action. In theory what you propose should be okay, but I feel like I might be missing something (I can’t think of immediately) so I’ll test out a few scenarios.

@MoritzLost
Copy link
Author

@engram-design Got it, thanks!

@martijnvanonz
Copy link

Hi all,

Is there maybe an update on this?

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

No branches or pull requests

3 participants