jenkins-bot has submitted this change and it was merged.
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(+), 7 deletions(-)
Approvals:
Jhernandez: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/specials/SpecialGather.php
b/includes/specials/SpecialGather.php
index 8d2755c..d16274b 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 ) ) {
@@ -102,18 +106,16 @@
/**
* Renders a user collection
- *
- * @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, '
+ __METHOD__ . ' requires the 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: merged
Gerrit-Change-Id: I2b7331b8c5ff72abfd5c2f1903b058c6fa1bf4ea
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits