Page MenuHomePhabricator

Special:PageMigration - Page search suggestion does not work
Open, NormalPublicBug

Description

Steps to reproduce

  1. Open Special:PageMigration
  2. Search in the Textbox for the name of a page

Expected behavior

Pages starting with a similar name should be shown in the suggestion box.

Actual behavior
No suggestion box appears, and an error is logged in the console.

Additional info
Here's the error logged in the console,

Uncaught TypeError: Cannot read property 'indexOf' of undefined
    at getFormData (searchSuggest.js?ed05e:54)

This is happening because our HTML Form does not have an action attribute and getFormData expects an action attribute. See code from that function below,

baseHref = $form.attr( 'action' );
baseHref += baseHref.indexOf( '?' ) > -1 ? '&' : '?';

This seems to be only used for tracking purposes.

Couple of things could be done to fix this,

  1. Add an empty action attribute to the form in SpecialPageMigration.php
  2. Add a check in getFormData before doing indexOf ... which I think we should do either way.

Event Timeline

abi_ created this task.Mar 6 2019, 7:39 AM
abi_ triaged this task as Normal priority.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 6 2019, 7:39 AM
abi_ moved this task from Backlog to In Progress on the User-abi_ board.Mar 13 2019, 8:59 AM

Change 496233 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Fix page suggestion not working on Special:PageMigration

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

abi_ moved this task from In Progress to Under Review on the User-abi_ board.Mar 13 2019, 6:47 PM

There were two issues here,

  1. When typing the name of the page, the suggestion dropdown was not visible. This was because the searchSuggest plugin expects the parent form to have an action attribute and this was missing for the form on the Migration page.
  2. Once the above issue was fixed, noticed that clicking on the suggestions would redirect the user.

Fixed the first issue by adding an empty action attribute to the form. The second was fixed by adding data-mw-searchsuggest="{ "wrapAsLink": false }" to the suggestion box input.

Note that there is an existing issue T217727: Special:PageMigration - "query - messagecollection" API throws an error due to which clicking on the import button will not do anything.

Test Case


Please find the test case below,

TC #1 - Suggestion box should display the list of pages with similar name

  1. Open the Special:PageMigration
  2. Start typing the name of the page that you know exists in the Wiki.
  3. Click on any one of the pages that appears in the suggestion list.

Expected Behavior

After step 2, you should see the suggestion box appear. On performing step 3, no redirection should occur and the clicked page name should simply get populated in the textbox.

Change 496233 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Fix page suggestion not working on Special:PageMigration

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

abi_ moved this task from Under Review to QA on the User-abi_ board.Mar 18 2019, 2:24 PM

Moving to QA

abi_ added a comment.Mar 18 2019, 2:28 PM

Niklas noticed an issue with the searchSuggestion plugin when using the Timeless skin. I've reported it here - T218565: Search suggestion appears in the same location for all searchSuggestion instances

Nikerabbit moved this task from QA to Done on the User-abi_ board.Tue, May 7, 9:08 AM

I have confirmed this on dev.translatewiki.net. With latest changes to Timeless, the dropdown is also correctly positioned.

There is some possible issue that nothing seems to happen on invalid input when submitting the form.

abi_ added a comment.Sun, May 12, 4:04 PM

There is some possible issue that nothing seems to happen on invalid input when submitting the form.

@Nikerabbit - What sort of invalid input? I'm seeing an error message pop up above the page title textbox based on what sort of invalid input I enter.

Specifically the case of a page with a language code which is not a translatable page seems to not cause any message at all. (For example MediaWiki:Jan/fi assuming that the page exists).

abi_ added a comment.Thu, May 23, 10:19 AM

I'm seeing the following -

Here T217726_1/fi is a page that exists, but is not translatable.

Nikerabbit added a comment.EditedThu, May 23, 2:02 PM

Can you reproduce the issue at https://translatewiki.net/wiki/Special:PageMigration with MediaWiki:Jan/fi as input?