Page MenuHomePhabricator

MediaViewer should adopt mediawiki.router
Closed, ResolvedPublic

Description

Migrated from: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/282

The current implementation of hash handling has some drawbacks:

  • It happens as a complex interaction between the viewer and the bootstrap classes, which is hard to follow, and causes mmv.js hash handling to not work when it is loaded by some other means than the bootstrap. (Also, we use to flags for the same thing, viewer.comingFromHashChange, and the closure scope variablecomingFromHashChange - that is probably unintentional)
  • It has too much low-level detail, mmv.js should be a high-level class coordinating other classes.
  • It is hard to scale; plugins will probably want to interact with the hash.

We now have a standard library used by other extensions - mediawiki.router - that would be better.

We should come up with a better system; probably remove most hash handling from the bootstrap (it should just listen to hash changes while the viewer is not loaded, then once it detects a MediaViewer/... hash, unregister itself,load the viewer and call its hash handler), and come up with some sort of routing system.

Event Timeline

MingleTerminator raised the priority of this task from to Medium.Dec 8 2014, 4:48 PM
MingleTerminator added a project: Multimedia.

Mass-removing the Multimedia tag from MediaViewer tasks, as this is now being worked on by the Reading department, not Editing's Multimedia team.

Jdlrobson renamed this task from Figure out better place of hash handling to MediaViewer should adopt mediawiki.router.Jul 7 2016, 4:54 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson moved this task from Incoming to Triaged but Future on the Web-Team-Backlog board.
MarkTraceur moved this task from Triaged but Future to In Process on the MediaViewer board.
MarkTraceur subscribed.

Taking this now, as it is a requirement for mobile support.

Change 510804 had a related patch set uploaded (by Simon04; owner: Simon04):
[mediawiki/extensions/MultimediaViewer@master] Adopt mediawiki.router

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

Change 510804 merged by jenkins-bot:
[mediawiki/extensions/MultimediaViewer@master] Adopt mediawiki.router

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

Change 598142 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/MultimediaViewer@master] mmv.bootstrap: Remove direct static call to OO.Router.prototype

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

Change 598142 merged by jenkins-bot:
[mediawiki/extensions/MultimediaViewer@master] mmv.bootstrap: Remove direct static call to OO.Router.prototype

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