Page MenuHomePhabricator

Send email based on form submission
Closed, ResolvedPublic

Description

We should introduce a class to handle processing the form submission from the API. The default processor does nothing with the data received via the API; this task would introduce a class to email address(es) with the data, using the format specified in T344997: Define email content and subject line

Acceptance criteria:
  • If configured, ReportIncident will email a list of email addresses with the contents of the incident report form
  • The "from" address is configurable
  • Unsetting the "to" address configuration disables sending emails
Steps to verify:
  1. Use MediaWiki-Docker
  2. Follow steps on https://www.mediawiki.org/wiki/MediaWiki-Docker/Configuration_recipes/Mail_handling to setup a mail server
  3. Rebuild the docker containers to apply the changes to the docker override file (docker compose down and then docker compose up -d)
  4. Install the ReportIncident extension
  5. Add the following to your LocalSettings.php:
$wgReportIncidentRecipientEmails = [ 'test@test.com' ];
$wgReportIncidentEmailFromAddress = 'test@localhost';
  1. Go to a user talk page
  2. Click on the "Report" button
  3. Click through to submit a report
  4. Fill out the form with test data
  5. Submit the form
  6. Load http://localhost:8025/

Check that an email is present at http://localhost:8025/ and the body of the email includes the data you submitted in step 9 and 10.

Event Timeline

Madalina changed the task status from Open to Stalled.Sep 5 2023, 1:19 PM

Stalled until T337635 is done

kostajh changed the task status from Stalled to Open.Sep 8 2023, 12:18 PM
kostajh claimed this task.

I'll build off the patch in T337635, so marking this as un-stalled.

Change 955932 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/ReportIncident@master] [WIP] email: Initial implementation to email moderators

https://gerrit.wikimedia.org/r/955932

Test wiki created on Patch demo by Dreamy Jazz using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/8e1a162db0/w

Test wiki on Patch demo by Dreamy Jazz using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/8e1a162db0/w/

Test wiki created on Patch demo by Dreamy Jazz using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/49509d6e6e/w

Test wiki on Patch demo by Dreamy Jazz using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/49509d6e6e/w/

Change 955932 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] email: Initial implementation to email moderators

https://gerrit.wikimedia.org/r/955932

I will need to put this ticket into the Hold / Blocked column until the email group is created...
For more information see comments regarding the creation of an email group for incident-report-system-beta (ticket https://phabricator.wikimedia.org/T339275)

Email group has been created, we can now use: incident-report-system-beta@wikimedia.org.

Dreamy_Jazz subscribed.

I have some steps that can be used on Patch Demo to QA this ticket:

  1. Create a Patch Demo wiki with the Inbox and ReportIncident extension installed at a minimum
  2. Log into an account
  3. Go to Special:Preferences#mw-prefsection-personal-email
  4. Click Change or remove email address
  5. Re-login to verify your identity if prompted to do so
  6. Use the form to change the email address for the Patch Demo account to a@example.com
  7. Load Special:Inbox
  8. Click on the email with the subject similar to Patch demo ... email address confirmation
  9. Find link with that includes the text Special:ConfirmEmail and copy the entire URL
  10. Paste the URL in a new tab
  11. Open a user talk page
  12. Create the user talk page if it does not exist
  13. Click on Report in the Tools menu
  14. Navigate to step 2
  15. Fill in the form with valid data
  16. Submit the form
  17. Load Special:Inbox
  18. Verification step 1: An email from b@example.com should appear as the top item in the table on Special:Inbox with a subject indicating that it is an incident report
  19. Click on the email from b@example.com (by clicking the link on the subject text)
  20. Verification step 2: The email body should be shown and contain the data that was entered into the form along with a link to the current revision of the user talk page and a link to email the user who reported the incident.

Using the QA Steps: I have verified the following 2 items have been implemented, and are displaying and functioning as expected at url https://patchdemo.wmflabs.org/wikis/c45087b29b/wiki/User_talk:Bob#Topic_Header_for_Report_Incident_for_English_Beta_Wiki
Good Work as always @Dreamy_Jazz, and thank you for the QA Steps!


  • Verification step 1: An email from b@example.com should appear as the top item in the table on Special:Inbox with a subject indicating that it is an incident report

image.png (818ร—787 px, 63 KB)

image.png (427ร—1 px, 71 KB)

image.png (438ร—1 px, 61 KB)


  • Verification step 2: The email body should be shown and contain the data that was entered into the form along with a link to the current revision of the user talk page and a link to email the user who reported the incident.

image.png (254ร—1 px, 36 KB)

Dreamy_Jazz updated the task description. (Show Details)