Page MenuHomePhabricator

Gallery image count is wrong
Closed, ResolvedPublic

Description

What I did:

  1. Insert > Gallery in 2017WTE
  2. Add two copies of the same image (double-clicked?)
  3. Delete the first.
  4. Insert the gallery. The gallery now contains one image.
  5. Cut, paste, and fix the wikitext for two other images. The gallery now contains three images.
  6. Switch from 2017WTE to the visual editor. The gallery displays the three images correctly.
  7. Click on the gallery
  8. Be surprised to see that the box says "4 images".

Screen Shot 2022-10-15 at 12.40.27 PM.png (828×1 px, 668 KB)

Event Timeline

Actually, the "steps to reproduce" are probably just:

  1. Open the page in the visual editor.
  2. Click on the gallery.

https://en.wikivoyage.org/wiki/Switzerland has the count wrong:

Screen Shot 2022-10-15 at 12.54.15 PM.png (618×2 px, 674 KB)

This does not appear in most pages, including https://en.wikivoyage.org/wiki/Warsaw or https://en.wikivoyage.org/wiki/Kyushu#Eat

The problem is we are including the caption node in the count.

Change 842945 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/VisualEditor@master] GalleryContextItem: Only count image node children

https://gerrit.wikimedia.org/r/842945

Change 842945 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] GalleryContextItem: Only count image node children

https://gerrit.wikimedia.org/r/842945

Change 880436 had a related patch set uploaded (by WgevaertWikiBase; author: WgevaertWikiBase):

[mediawiki/extensions/VisualEditor@REL1_35] GalleryContextItem: Only count image node children

https://gerrit.wikimedia.org/r/880436

Change 880436 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@REL1_35] GalleryContextItem: Only count image node children

https://gerrit.wikimedia.org/r/880436

Change 881395 had a related patch set uploaded (by WgevaertWikiBase; author: WgevaertWikiBase):

[mediawiki/extensions/VisualEditor@master] Use getImageNodes instead of custom filter

https://gerrit.wikimedia.org/r/881395

Change 881397 had a related patch set uploaded (by WgevaertWikiBase; author: WgevaertWikiBase):

[mediawiki/extensions/VisualEditor@REL1_38] GalleryContextItem: Only count image node children

https://gerrit.wikimedia.org/r/881397

Change 881398 had a related patch set uploaded (by WgevaertWikiBase; author: WgevaertWikiBase):

[mediawiki/extensions/VisualEditor@REL1_39] GalleryContextItem: Only count image node children

https://gerrit.wikimedia.org/r/881398

Change 881398 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@REL1_39] GalleryContextItem: Only count image node children

https://gerrit.wikimedia.org/r/881398

Change 881397 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@REL1_38] GalleryContextItem: Only count image node children

https://gerrit.wikimedia.org/r/881397

Change 881395 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Use getImageNodes instead of custom filter

https://gerrit.wikimedia.org/r/881395