Page MenuHomePhabricator

Section-level images: clear `hasrecommendation:section_image` flag when an image is added to the article
Open, MediumPublic

Description

User story & summary:

As a editor, I want to receive good image suggestions, because I'm more likely to make an edit that will be reverted if an image is suggested that is already added elsewhere in the article

Background:

This task is important because we expect structured tasks suggested to newcomers to be accurate >70% of the time. Image suggestions are less likely to be accurate if an image has been added to the article since the suggestion was generated.

We should clear the hasrecommendation:section_image flag for an article article if:

  • someone edits the article to add an image to the article (anywhere in the document) without using the suggested edits interface
  • someone edits the article to add a section-level image recommendation using the suggested edits interface
Acceptance Criteria:

Given there is an article with a hasrecommendation:section_image flag,
When:

  • someone edits the article to add an image to the article (anywhere in the document) without using the suggested edits interface
  • someone edits the article to add a section-level image recommendation using the suggested edits interface

Then the hasrecommendation:section_image flag is cleared for that article

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
ResolvedKStoller-WMF
OpenNone
OpenNone
DuplicateNone
ResolvedTgr
OpenNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedKrenair
ResolvedKrenair
Resolved demon
Duplicate demon
DuplicateNone
ResolvedJdlrobson
ResolvedKrinkle
OpenNone
Resolvedkostajh
OpenNone
ResolvedUrbanecm_WMF
OpenNone
OpenNone
ResolvedUrbanecm_WMF
OpenNone
OpenNone
ResolvedUrbanecm_WMF
ResolvedZabe
StalledNone
OpenNone
ResolvedUrbanecm_WMF
ResolvedUrbanecm_WMF
ResolvedUrbanecm_WMF
DeclinedSgs
ResolvedUrbanecm_WMF
ResolvedUrbanecm_WMF
ResolvedUrbanecm_WMF
ResolvedUrbanecm_WMF
ResolvedUrbanecm_WMF
ResolvedBUG REPORTUrbanecm_WMF
ResolvedBUG REPORTUrbanecm_WMF
OpenSpikeNone
ResolvedUrbanecm_WMF
ResolvedUrbanecm_WMF
OpenLadsgroup
OpenNone
OpenNone
OpenNone
OpenNone
Resolvedkostajh
OpenNone
StalledNone
ResolvedSgs
OpenNone
OpenUrbanecm_WMF
OpenNone
OpenNone
OpenNone
OpenFeatureNone
ResolvedUrbanecm_WMF
OpenNone
OpenNone

Event Timeline

After thinking this through, it's not as simple as I thought, sorry.

I said earlier that we are doing this already for article-level image recommendations; that was wrong. We only have somewhat similar logic for link recommendations (via the SearchDataForIndex2 hook handler), but there 1) we can rely on our local recommendations cache to do certain checks, 2) running out of recommendations isn't really a concern since we can generate them quickly and frequently. So that solution is not applicable here.

The thing is, there are very few places in MediaWiki where you can efficiently decide whether an image got added; and for section-level images we need to differentiate an edit adding an image to the article from an edit to an article that had images (but the edit didn't touch them). There are several hooks with access to the ParserOutput (which tells what images are present in a given version of the page), and some hooks which give access to both the old and new version of the page (so the old and new ParserOutput could be generated; but that's an expensive operation, and these hooks are called during save and are performance-sensitive); but there isn't any hook that readily provides access to the old and new ParserOutput (or equivalent information).

The closest thing is LinksUpdate, which provides a before/after view of internal and external links, but not images. It would probably not be too hard to add, but obviously that's not something to attempt while the MVP isn't finished.

DMburugu subscribed.

Moving to maintenance as it appears we may want to attempt this at some point