Page MenuHomePhabricator

Add a new edit filter trigger action: pop-up box
Open, Needs TriagePublicFeature

Description

Feature summary (what you would like to be able to do and where):
AbuseFilter should be able to notify users of certain kinds of issues while they are editing (rather than after clicking the save button). This can be surfaced to the user as popup notifications, similar to T285508.

Possible solution (as worked out with @suffusion_of_yellow )
When the user stops typing in the edit box for a few seconds, an action=stashedit call is already being sent to the server with the full textarea contents. Parsing takes place, which includes checking against abuse filters. But currently, results of checks are not exposed to the user. It is suggested that in case of filters with pop-up action, we send the check results in the action=stashedit response and use some javascript to create pop-ups.

Use case(s) and benefits
See T265163: Create a system to encode best practices into editing experiences

Inspired from enwiki discussion: https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)/Archive_194#Adding_a_new_edit_filter_trigger_action:_pop-up_box started by @Sdkb

Event Timeline

Rough outline of changes needed to implement this: (please let me know if I'm missing something)

In core:

  • Modify parseAndCache() to take the API response object which it would modify
  • Modify ParserOutputStashForEdit hook to also take the API response object, allowing extensions to modify it
  • Add JavaScript hook fired with the ApiStashEdit response which extension-loaded JS can intercept

In AbuseFilter:

  • Add a Popup consequence
  • Modify existing use of ParserOutputStashForEdit hook to add the response fields
  • Add javascript module for creating popups based on intercepted API response