Page MenuHomePhabricator

"Categories" item gets duplicated in basic upload form at Commons
Closed, ResolvedPublic


Steps to reproduce:

  1. Go to
  2. Scroll to the end. See (one) "Categories (?) (+)".
  3. Scroll back up a bit and [Browse] for a Source filename.
  4. Scroll to the end. See two "Categories (+)" (but only one blue (?) button).
  5. Scroll back up a bit and set the destination file name.
  6. Scroll to the end. See three "Categories (+)".
  7. Scroll back up and change the destination file name to something else.
  8. Scroll to the end. See that yet another "Categories (+)" has been added now.
  9. Repeat the last two steps as many times as you feel like.

Bonus step:

Use one of the extra Categories links to add a category. Upload the file. Discover that your cat wasn't added.

Event Timeline

Restricted Application added a project: Multimedia. · View Herald TranscriptMar 31 2016, 5:26 PM
Restricted Application added subscribers: Steinsplitter, Aklapper. · View Herald Transcript
Restricted Application added a subscriber: Matanya. · View Herald TranscriptMar 31 2016, 5:28 PM
matmarex closed this task as Invalid.Apr 1 2016, 8:12 PM
matmarex added a subscriber: matmarex.

Unfortunately this is Commons-specific code and not something we (Multimedia) maintain. Previously reported here:

TheDJ added a subscriber: TheDJ.Apr 1 2016, 8:21 PM

HotCat was recently changed (T103285) to listen to wikipage.content, but on the upload page, we trigger mw.hook wikipage.content for the preview of the file, so that explains the behavior. HotCat is now listening to the wrong event.

matmarex reopened this task as Open.May 12 2016, 12:27 AM

Eh, let's reopen this, it looks like I'm going to have to do this because apparently no one at Commons feels responsible for HotCat anymore.

matmarex closed this task as Resolved.May 12 2016, 12:50 AM
matmarex claimed this task.
matmarex added a subscriber: kaldari.

Indeed, this is caused by the combination of 002d1f15aafa3bb9d4c142408a73432f24fac2f5 (for T51751 by @TheDJ) and (for T103285 by @kaldari). Thanks for the pointer, @TheDJ, this would have taken a lot of time to debug without that. :)

I think I patched this in HotCat just keeps getting uglier with all these fixes on top of fixes :(

@TheDJ: When I had HotCat listening for the postEdit hook, you said that wasn't the right hook to use. I then changed it to use the wikipage.content hook instead, which you say is also the wrong hook. If you know which hook HotCat should be listening for, can you please just tell us?

TheDJ added a comment.May 13 2016, 6:21 AM

@kaldari wrong is a big word.

But anyway: wikipage.categories was introduced almost at the same time, and probably counts as the 'right hook'

But that one probably doesn't even work yet icw VE. And as this ticket testifies, at that time wikipage.content was not even triggered on the upload page, so it's all a bit of baby step forward causing a sidestep once in a while.