Page MenuHomePhabricator

Implement "Creating new section" variable
Open, Needs TriagePublic

Description

As far as I can see there is no way to detect if an edit is a section creation.

Looking for "new section" auto-summary keyword works in test filter tool but not on live (test here).

I purpose to implement such variable, useful to verify that new section title is not the default on help desk.

Event Timeline

Daimona subscribed.

See T58371 (and consequently T191722) for why checking the summary doesn't work. I still have to check if the EditFilterMergedContent hook provides enough context to determine whether the edit is creating a new section.

@Daimona I recently submitted T226563. If that task was implemented, would it provide a possible solution?

No, tags are applied after filters are executed.

I forgot to check the code, I'll try to do that tomorrow.

So I checked EditPage. The section being edited is saved in a class property, EditPage::section. Unfortunately, it's not passed as argument to the hook, and thus it's impossible to read it from AbuseFilter. The two solutions I can think of:

  1. Add it to the hook params. However, this may not be optimal (lots of params...)
  2. Read it from the request, like EditPage does: $this->section = $request->getVal( 'wpSection', $request->getVal( 'section' ) );. However, this could be unreliable as it would miss any value manipolation done by EditPage.