Robmoen has uploaded a new change for review.

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

Change subject: WIP: I should be able to view other users public lists
......................................................................

WIP: I should be able to view other users public lists

Blocked on:  T92299

Bug: T92543
Change-Id: Iecab1d22a3df8b5da693a30d4a6aacf4d8f8afec
---
M includes/api/ApiQueryListPages.php
M includes/models/Collection.php
M includes/models/CollectionsList.php
M includes/specials/SpecialGather.php
4 files changed, 10 insertions(+), 7 deletions(-)


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

diff --git a/includes/api/ApiQueryListPages.php 
b/includes/api/ApiQueryListPages.php
index 02475a1..c4e7f86 100644
--- a/includes/api/ApiQueryListPages.php
+++ b/includes/api/ApiQueryListPages.php
@@ -62,9 +62,13 @@
                if ( $params['id'] ) {
                        // Runs this code whenever ID is given and is not 0 
(watchlist)
                        // Will be removed once DB storage is implemented
+                       if ( isset( $params['owner'] ) ) {
+                               $user = User::newFromName( $params['owner'] );
+                       }
                        $this->tempProcessCollectionFromJson( $resultPageSet, 
$params, $user );
                        return;
                }
+
 
                $this->selectNamedDB( 'watchlist', DB_SLAVE, 'watchlist' );
                $this->addTables( 'watchlist' );
@@ -239,7 +243,7 @@
                                ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2,
                        ),
                        'owner' => array(
-                               ApiBase::PARAM_TYPE => 'user',
+                               ApiBase::PARAM_TYPE => 'string',
                        ),
                        'token' => array(
                                ApiBase::PARAM_TYPE => 'string',
diff --git a/includes/models/Collection.php b/includes/models/Collection.php
index 8ef87c2..45d7cab 100644
--- a/includes/models/Collection.php
+++ b/includes/models/Collection.php
@@ -111,12 +111,14 @@
                                $collection = self::newFromCollectionInfo( $c );
                        }
                }
+
                if ( $collection ) {
                        $api = new ApiMain( new FauxRequest( array(
                                'action' => 'query',
                                'prop' => 'pageimages|extracts',
                                'generator' => 'listpages',
                                'glspid' => $id,
+                               'glspowner' => $user->getName(),
                                'explaintext' => true,
                                'exintro' => true,
                                'exchars' => ItemExtracts::CHAR_LIMIT,
diff --git a/includes/models/CollectionsList.php 
b/includes/models/CollectionsList.php
index c87c4e4..744da80 100644
--- a/includes/models/CollectionsList.php
+++ b/includes/models/CollectionsList.php
@@ -90,6 +90,7 @@
                $api = new ApiMain( new FauxRequest( array(
                        'action' => 'query',
                        'list' => 'lists',
+                       'owner' => $user->getName(),
                ) ) );
                $api->execute();
                $data = $api->getResultData();
diff --git a/includes/specials/SpecialGather.php 
b/includes/specials/SpecialGather.php
index b141559..c4d3658 100644
--- a/includes/specials/SpecialGather.php
+++ b/includes/specials/SpecialGather.php
@@ -84,18 +84,14 @@
         * @param int $id collection id
         */
        public function renderUserCollection( User $user, $id ) {
-               $collection = null;
-               // FIXME: It should be possible to view public lists by other 
user. Limitation with API stops this.
-               if ( $this->isOwner( $user ) ) {
-                       $collection = models\Collection::newFromApi( $id, $user 
);
-               }
+               $collection = models\Collection::newFromApi( $id, $user );
 
                if ( $collection === null ||
                        ( !$collection->isPublic() && !$this->isOwner( $user ) 
) ) {
                        // FIXME: No permissions to visit this. Showing not 
found ATM.
                        $this->renderError( new views\NotFound() );
                } else {
-                       $this->render( new views\Collection( $this->getUser(), 
$collection ) );
+                       $this->render( new views\Collection( $user, $collection 
) );
                }
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iecab1d22a3df8b5da693a30d4a6aacf4d8f8afec
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Robmoen <rm...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to