From dbe57993a4c685bbe906febc32f82e1cb568f1ed Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sun, 13 Oct 2024 09:18:33 +0200 Subject: [PATCH] Remove support for legacy route #/mediaviewer/File: This route has been declared legacy in 2015 via I0936ada35141ddd85e0aa232b833d315e3246ce3. On English Wikipedia for a given day there was no usage of this route. Change-Id: I41b33697669500670bea6506dc45c5c6a613c502 --- resources/mmv.bootstrap/mmv.Config.js | 9 --------- resources/mmv.bootstrap/mmv.bootstrap.js | 3 +-- tests/qunit/mmv/mmv.bootstrap.test.js | 8 -------- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/resources/mmv.bootstrap/mmv.Config.js b/resources/mmv.bootstrap/mmv.Config.js index cebfd40fe..023f3d6cd 100644 --- a/resources/mmv.bootstrap/mmv.Config.js +++ b/resources/mmv.bootstrap/mmv.Config.js @@ -49,15 +49,6 @@ class Config { return /\/(\d+)$/; } - /** - * Regular expression representing the legacy media route - * - * @return {RegExp} - */ - static get LEGACY_ROUTE_REGEXP() { - return /^mediaviewer\/(.+)$/; - } - /** * Returns true if MediaViewer should handle thumbnail clicks. * diff --git a/resources/mmv.bootstrap/mmv.bootstrap.js b/resources/mmv.bootstrap/mmv.bootstrap.js index d247da603..577f6804f 100644 --- a/resources/mmv.bootstrap/mmv.bootstrap.js +++ b/resources/mmv.bootstrap/mmv.bootstrap.js @@ -93,7 +93,6 @@ class MultimediaViewerBootstrap { */ setupRouter( router ) { router.addRoute( Config.ROUTE_REGEXP, this.route.bind( this ) ); - router.addRoute( Config.LEGACY_ROUTE_REGEXP, this.route.bind( this ) ); this.router = router; } @@ -549,7 +548,7 @@ class MultimediaViewerBootstrap { */ isViewerHash() { const path = location.hash.slice( 1 ); - return path.match( Config.ROUTE_REGEXP ) || path.match( Config.LEGACY_ROUTE_REGEXP ); + return path.match( Config.ROUTE_REGEXP ); } /** diff --git a/tests/qunit/mmv/mmv.bootstrap.test.js b/tests/qunit/mmv/mmv.bootstrap.test.js index 432e16735..0b10777c4 100644 --- a/tests/qunit/mmv/mmv.bootstrap.test.js +++ b/tests/qunit/mmv/mmv.bootstrap.test.js @@ -399,14 +399,6 @@ const { asyncMethod, waitForAsync, getMultimediaViewer } = require( './mmv.testh return hashTest( '/media', bootstrap, assert ); } ); - QUnit.test( 'Load the viewer on a legacy hash', ( assert ) => { - location.hash = ''; - - const bootstrap = createBootstrap(); - - return hashTest( 'mediaviewer', bootstrap, assert ); - } ); - QUnit.test( 'Overlay is set up on hash change', function ( assert ) { location.hash = '#/media/foo';