Page MenuHomePhabricator

"Open in Media Viewer" box appears twice after editing file page
Closed, ResolvedPublic

Description

The "Open in Media Viewer" box appears twice, one on top of the other, when viewed on file description pages using Mozilla Firefox 40.0.2 (the latest version).

Event Timeline

Jacklee created this task.Aug 27 2015, 8:20 AM
Jacklee updated the task description. (Show Details)
Jacklee raised the priority of this task from to Low.
Jacklee added a project: Commons.
Jacklee added a subscriber: Jacklee.
Restricted Application added subscribers: Steinsplitter, Aklapper. · View Herald TranscriptAug 27 2015, 8:20 AM
Steinsplitter moved this task from Incoming to Backlog on the Commons board.Aug 27 2015, 10:46 AM
Steinsplitter added a project: MediaViewer.
Steinsplitter set Security to None.
Restricted Application added a project: Multimedia. · View Herald TranscriptAug 27 2015, 10:46 AM
Steinsplitter raised the priority of this task from Low to Needs Triage.Aug 27 2015, 10:47 AM
Restricted Application added a subscriber: Matanya. · View Herald TranscriptAug 27 2015, 10:47 AM
Tgr added a subscriber: Tgr.Aug 27 2015, 7:53 PM

Can't reproduce on 40.0 (which is the latest stable on Ubuntu). Do you see this on every wiki? Also when logged out?

I don't see the problem when using Safari on my iPad.

It's intermittent. Sometimes there are two pairs; some times one, even on the same page. see https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#Duplicate_media_viewer_links

Tgr added a comment.Aug 29 2015, 11:37 PM

Is this Monobook-only?

Redrose64 added a comment.EditedAug 30 2015, 2:39 PM

No, I normally use MonoBook, but just now I switched to Vector, edited File:First Minister of Scotland, Nicola Sturgeon.jpg and immediately got two pairs of "Open in Media Viewer"/cogwheel link boxes above the "This file is unlicensed for use on Wikipedia" box. Also happened with the next two file description pages that I edited too (also Vector).

Tgr added a comment.Aug 30 2015, 5:57 PM

You mentioned editing on the village pump as well. Does this always happen after saving an edit?

@Tgr yes, I believe this is only after editing, and as far as I can tell it happens every time...

Have just found that English Wikipedia is affected as well as Commons

Tgr added a comment.Aug 31 2015, 9:05 PM

Possibly related to https://gerrit.wikimedia.org/r/#/c/231079 since not much else changed. Do we fire the postEdit hook even after a normal edit?

We do. Is there a reason you didn't use wikipage.content hook? (It is fired after the page is loaded or previewed, after a page is saved with VE and updated, and when it's previewed with live preview – generally every time when the page content is updated. ''mediawiki.page.image.pagination' fires it too, it seems, which you might also want to hook to.)

(Generally, wikipage.content hook is what you want to use if you were using the document-ready event previously, and now want to effortlessly support VE and live preview too.)

Tgr added a comment.Sep 1 2015, 2:44 AM

I didn't write that code but I would guess the reason is JS hooks are not documented anywhere and which one to use when is only passed down via oral tradition.
Thanks for doing that; I'll file a patch :)

Change 235176 had a related patch set uploaded (by Gergő Tisza):
Use wikipage.content hook for updating thumbnail list

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

The core JS hooks are actually documented at https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook , which to be honest is a pretty sneaky place to document them.

Change 235176 merged by jenkins-bot:
Use wikipage.content hook for updating thumbnail list

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

matmarex renamed this task from "Open in Media Viewer" box appears twice to "Open in Media Viewer" box appears twice after editing file page.Sep 1 2015, 1:54 PM
matmarex closed this task as Resolved.
matmarex triaged this task as High priority.
matmarex assigned this task to Tgr.
matmarex removed a project: Patch-For-Review.
Yann added a subscriber: Yann.Sep 2 2015, 4:28 PM

This still happens to me on Commons today (Chrome, Win7).

matmarex added a comment.EditedSep 2 2015, 4:35 PM

Yes; sorry, the patch was not deployed separately. It will go out to Commons with the regular 1.26wmf21 deployment later today (see https://www.mediawiki.org/wiki/MediaWiki_1.26/Roadmap).

@Yann, it should be resolved on Commons now. Can you confirm? Thanks.