Page MenuHomePhabricator

Reporting form sends username for the reportingUserId property of the API request
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

When using the Report Incident form, the form asks for a username that you want to report. However the API requests a user ID and the frontend sends the text in the username field (without validation) to the API. As the form asks for a username (and not an ID) this means the username will be converted to an integer.

Steps to reproduce problem
  1. Install ReportIncident
  2. Open a user talk page and open the network tab in inspect element
  3. Click the "Report" button
  4. Click the "Proceed to file a report" button
  5. Open DevTools and click on the network tab
  6. Fill in the form, specifying a username in Username you would like to report as asked for

Expected behaviour: The API request body specifies a username as the reportedUserID property.
Observed behaviour: The API request body should specify an ID or specify that the property is actually the username

Environment

Wiki(s): ReportIncident (ee99199) 07:09, 19 September 2023

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald Transcript

We should probably change the API to accept a username instead. The DiscussionTools thread item data gives us a username, not a numeric ID.

It probably makes sense to do that as currently you couldn't report IPs (as they have no user ID).

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

[mediawiki/extensions/ReportIncident@master] Suggest usernames for the reported username field

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

Change 964565 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] Suggest usernames for the reported username field

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

For QA, I would suggest following the steps to reproduce and the observed behaviour should be that a reportedUser property is set to the username you entered in the form. The request body should look like:

{"reportedUser":"Abuse filter","details":"test","behaviors":["threats-or-violence"],"revisionId":16895}

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

I have verified the fix for this issue has been implemented and is working as expected per the Ticket Description... Thank you @Dreamy_Jazz!!!
Testing was performed at the following url:
https://ko.wikipedia.beta.wmflabs.org/wiki/์‚ฌ์šฉ์žํ† ๋ก :QS5E

image.png (940ร—1 px, 724 KB)

image.png (940ร—1 px, 145 KB)

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

https://patchdemo.wmflabs.org/wikis/0ca007bc0f/w/