Skip to content

Commit

Permalink
Fix multiple approvals firing for draft submissions
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Jan 31, 2020
1 parent a23a667 commit 429fb97
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/services/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,14 @@ public function onAfterSaveEntry(ModelEvent $event)
Workflow::$plugin->getSubmissions()->rejectSubmission();
}

// For the cases where its been submitted from the front-end, its not a draft!
if ($action === 'approve-submission') {
Workflow::$plugin->getSubmissions()->approveSubmission($event->sender);
// Probably a better way to deal with this, but at this point, its no longer a draft
// its now a fully realised entry. We rely on the query param to determine if this was
// a draft that was approved and saved, or a regular entry that was approved.
if (!$request->getParam('draftId')) {
Workflow::$plugin->getSubmissions()->approveSubmission($event->sender);
}
}
}

Expand Down

0 comments on commit 429fb97

Please sign in to comment.