Page MenuHomePhabricator

Something else textbox value is not sent in email when only the Something else option is ticked
Closed, ResolvedPublicBUG REPORT

Description

The Something else textbox content is not included in the email sent to the administrators when the only behaviour selected is Something else. When other options are selected, this does not occur.

Steps to replicate the issue
  1. Install the ReportIncident extension
  2. Make sure $wgReportIncidentDeveloperMode = true; (this is the default and not needed for patch demo)
  3. Define $wgReportIncidentRecipientEmails and $wgReportIncidentEmailFromAddress with appropriate values (not needed for patchdemo)
  4. Log into an account
  5. Load a user talk page
  6. Open the browser console
  7. Click on Report in the Tools menu
  8. Navigate to the second step of the dialog (where the form is)
  9. Fill out the form with valid data, but only choose Something else as the behaviours and enter text entered into the textbox in the textbox that appears below.
  10. Submit the form

What happens?:
The email in the browser console incorrectly lists the behaviours as Behaviors: something-else in the Body of the email instead of specifying what the something-else is.

What should have happened instead?:
The email in the browser console should have the behaviours as Behaviors: text entered into the textbox.

Software version

MediaWiki 1.42.0-alpha (9f36d83) 08:44, 26 October 2023. ReportIncident โ€“ (03c2f31) 10:58, 27 October 2023.

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptOct 27 2023, 12:07 PM

This seems to be caused by the array_search call being treated as a in_array call, such that if the something-else behaviour is the first item (and has an index of 0), the 0 gets treated as false and therefore the code incorrectly deems the something-else behaviour as not selected.

I noticed this as the test coverage which should be 100% on the ReportIncidentMailer.php was not 100% as the test places something-else as the first behaviour in the behaviours list.

Change 969322 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/ReportIncident@master] Fix array_search result comparison in ReportIncidentMailer

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

Change 969322 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] Fix array_search result comparison in ReportIncidentMailer

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

Test wiki created on Patch demo by DJacksonA using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/70e76793db/w

I have verified the new code has been implemented and is functioning and displaying per the expected result listed in the ticket Description.
Testing was executed at https://patchdemo.wmflabs.org/wikis/70e76793db/wiki/User_talk:Bob
As always @Dreamy_Jazz thank you for the great work.

image.png (335ร—1 px, 47 KB)

image.png (912ร—445 px, 252 KB)

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

https://patchdemo.wmflabs.org/wikis/70e76793db/w/