jenkins-bot has submitted this change and it was merged.

Change subject: Rework init script for Special:Gather
......................................................................


Rework init script for Special:Gather

No need to check, if the collection id matches, just always use 
wgGatherCollections.

Bug: T93933
Change-Id: I1bb79f96f93034e4783f6504a3015a7951c8feac
---
M includes/specials/SpecialGather.php
M resources/ext.gather.special/init.js
2 files changed, 3 insertions(+), 9 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialGather.php 
b/includes/specials/SpecialGather.php
index 4b8b3dd..9c3ed1f 100644
--- a/includes/specials/SpecialGather.php
+++ b/includes/specials/SpecialGather.php
@@ -120,7 +120,7 @@
                        // FIXME: No permissions to visit this. Showing not 
found ATM.
                        $this->renderError( new views\NotFound() );
                } else {
-                       $this->getOutput()->addJsConfigVars( 
'wgGatherCollections', array( $collection->toArray() ) );
+                       $this->getOutput()->addJsConfigVars( 
'wgGatherCollections', $collection->toArray() );
                        $this->render( new views\Collection( $this->getUser(), 
$collection ) );
                        $this->updateCollectionImage( $collection );
                }
diff --git a/resources/ext.gather.special/init.js 
b/resources/ext.gather.special/init.js
index cf18544..919fe98 100644
--- a/resources/ext.gather.special/init.js
+++ b/resources/ext.gather.special/init.js
@@ -7,14 +7,8 @@
 
        /** Add routes for editing and deleting to the overlay manager */
        function addOverlayManagerRoutes() {
-               overlayManager.add( /^\/collection\/(.*)\/(.*)$/, function ( 
action, id ) {
-                       id = parseInt( id, 10 );
-                       var collection;
-                       $.each( mw.config.get( 'wgGatherCollections' ), 
function () {
-                               if ( this.id === id && this.isWatchlist === 
false ) {
-                                       collection = this;
-                               }
-                       } );
+               overlayManager.add( /^\/collection\/(.*)\/(.*)$/, function ( 
action ) {
+                       var collection = mw.config.get( 'wgGatherCollections' );
 
                        if ( collection ) {
                                if ( action === 'edit' ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/199663
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1bb79f96f93034e4783f6504a3015a7951c8feac
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to