Jdlrobson has uploaded a new change for review.

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

Change subject: Add url Special:Gather/id/{id} number
......................................................................

Add url Special:Gather/id/{id} number

This is needed to make CheckUser / Special:Log work better and
more cleanly.

Change-Id: I2b7331b8c5ff72abfd5c2f1903b058c6fa1bf4ea
---
M includes/specials/SpecialGather.php
1 file changed, 9 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather 
refs/changes/79/204679/1

diff --git a/includes/specials/SpecialGather.php 
b/includes/specials/SpecialGather.php
index 8d2755c..2cdd4af 100644
--- a/includes/specials/SpecialGather.php
+++ b/includes/specials/SpecialGather.php
@@ -58,7 +58,11 @@
                        } else {
                                $this->renderUserCollectionsList( $user );
                        }
-
+               } elseif ( preg_match( '/^id\/(?<id>\d+)$/', $subpage, $matches 
) ) {
+                       // Collection page
+                       // /id/:id
+                       $id = (int)$matches['id'];
+                       $this->renderUserCollection( $id );
                } elseif ( preg_match( '/^by\/(?<user>[^\/]+)\/(?<id>\d+)$/', 
$subpage, $matches ) ) {
                        // Collection page
                        // /by/:user/:id
@@ -69,7 +73,7 @@
                                // Invalid user
                                $this->renderError( new views\NotFound() );
                        } else {
-                               $this->renderUserCollection( $user, $id );
+                               $this->renderUserCollection( $id );
                        }
 
                } elseif ( preg_match( '/^all(\/(?<mode>[^\/]+))?\/?$/', 
$subpage, $matches ) ) {
@@ -106,14 +110,15 @@
         * @param User $user collection owner
         * @param int $id collection id
         */
-       public function renderUserCollection( User $user, $id ) {
+       public function renderUserCollection( $id ) {
                if ( !is_int( $id ) ) {
                        throw new InvalidArgumentException(
                                __METHOD__ . ' requires the second parameter to 
be an integer, '
                                . gettype( $id ) . ' given.'
                        );
                }
-               $collection = models\Collection::newFromApi( $id, $user, 
$this->getRequest()->getValues() );
+               $collection = models\Collection::newFromApi( $id, null,
+                       $this->getRequest()->getValues() );
 
                if ( $collection === null ||
                        // If collection is private and current user doesn't 
own it

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b7331b8c5ff72abfd5c2f1903b058c6fa1bf4ea
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

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

Reply via email to