[com_privacy] Delete request if we cant send email #23096
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #23074
Summary of Changes
If mail is enabled in Joomla config, but we were unable to send the email, the request is created, but the error message states that the request was not created.
There is no point in creating a request if we cannot send the email - this is why mailing has to be enabled. If your mail settings are wrong, the mail cannot be sent, and therefore we should remove the request and inform the user correctly.
Testing Instructions
Default 3.9.0 installation with this PR.
Create a "Create Request" Menu item using Privacy -> Create Request menu type
in Joomla Global Config set:
Login to frontend of the site
Click Create Request
Enter email address
Click submit
Expected result
and NO ROW left in #__privacy_requests
Actual result
(note this error was NOT generated with the above testing instructions, for this one you need to disable mail in php which is harder than the above testing instructions.)
and ROW left in #__privacy_requests even though the error says no request was made.
Documentation Changes Required
None