Page MenuHomePhabricator

Prevent users from selecting a federated property with a non-supported data type
Closed, ResolvedPublic8 Estimated Story Points

Description

When adding a statement with federated properties enabled, I am currently able to search for and select any Wikidata property, even those that have a data type not supported by my version of Wikibase (e.g. lexemes, musical notation, and so on -- this accounts for approximately 60 properties). Picking one of these unsupported properties results in an error notification that prompts me to hard refresh the Wikibase.

We should filter out properties with unsupported data types from appearing in the search results for properties when federation is enabled.

The number of results returned should be the same as the default in Wikibase/Wikidata (7).

BDD Scenario: Adding a statement to a local item
Given I have federated properties enabled from a source Wiki with unsupported data types
When I enter the [partial] label or P# of a property with an unsupported data type
Then the default quantity of possible properties is displayed in the results list
And unsupported properties are not displayed in the results list

What's there now

Screenshot_2020-05-06 Adam's Hat.png (198×272 px, 13 KB)

Event Timeline

Samantha_Alipio_WMDE renamed this task from Issues when selecting a federated property with a non-supported data type to Prevent users from selecting a federated property with a non-supported data type.May 28 2020, 11:50 AM
Samantha_Alipio_WMDE updated the task description. (Show Details)

During task breakdown we decided a good first approach for this would be entirely in PHP

  • ApiEntitySearchHelper should ask for more results than needed from the remote API
  • ApiEntitySearchHelper should filter results and only return properties with known data types
    • WikibaseRepo->getDataTypeDefinitions->getTypeIds can be used in PHP to get the list of enabled data value type ids (needed for filtering)

One thing to consider is:

  • The UI makes the decision to show or not show the "more" button based on how many results are returned from the API / if search-continue key is returned. We should make sure we don't make this do bad things.
    • If the user asks for 8, and we ask wikidata for 12, and we get 12, filter 5 and return 7, no more button will be shown if only 7 are returned (evil)
  • Perhaps logging these cases, or throwing an exception might be fine for now? As the case discussed should be fairly unlikely for now.

Tech pointers:

  • WikibaseRepo->getDataTypeDefinitions->getTypeIds for getting PHP data types that are enabled in PHP
  • JS code that we think is doing the search in the UI side, view/resources/jquery/wikibase/jquery.wikibase.entityselector.js (although we didn't find where the limit is in the call)

search-continue <<<<<<<<<<<<<<<<<<<<<<<<<<<< This is important

Tested and verified by searching for properties with Mathematical expression, Musical notation, and Lexeme data types.

Addshore triaged this task as Medium priority.Jul 1 2020, 8:55 AM