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

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 26 2018, 8:09 PM
Daimona added a subscriber: Daimona.

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.

MJL added a subscriber: MJL.Jul 5 2019, 7:16 PM

@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.

MJL awarded a token.Jul 6 2019, 5:54 AM

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.