ContentTranslation has a dedicated class, AbuseFilterCheck, used to preemptively check filters while the translation is being written. TTBOMK, it first checks the page as a whole, and then the text of each translation unit.
This is done by putting together various hacks, and using internal AF logic [1] in a way that is not easy for me to maintain (because these internals must be kept exposed somehow). On top of the maintenance burden, this has also been the case of issues in the past, e.g. T155897.
Additionally, the error messages shown by ContentTranslation are worsening the user experience, because it's just using a generic error message for all actions. It doesn't make any distinction between warn, disallow, block, etc., and for 'disallow' it doesn't show the specific message used by the filter (it does so for warn with another hack, AFAICS).
All in all, this code is problematic and IMHO it should be removed to avoid maintenance burden. As a replacement, I'm proposing the following:
- CX should run a hook before saving the translation; the hook would work similar to EditFilterMergedContent
- AbuseFilter would add a handler for that hook, and run everything as it usually does
- CX would receive a list of messages that can be shown above the interface
Thoughts?
[1] - Which, being crappy legacy code, is obviously not marked as internal but as public static
Context: this code was added to address T114621