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

Change subject: UserPageCollectionsList shows collection images
......................................................................


UserPageCollectionsList shows collection images

Store in the GatherCollections.json a field "image" with the title of the file
for the collections list to show images.

example json: https://gist.github.com/joakin/c62b4d1b751ffd419b25

Tasks:
* https://trello.com/c/H6lExls3/18-5-add-collection-to-index
* 
https://trello.com/c/6wlRh6Md/5-the-page-image-shown-in-list-of-collections-is-an-arbitrary-image-from-the-list-e-g-first-page-that-has-an-image

Change-Id: Iaef23ff58ccacdf1d26fb158d0dcdfd3de812120
---
M includes/models/CollectionBase.php
M includes/stores/UserPageCollectionsList.php
M includes/stores/WatchlistCollection.php
3 files changed, 16 insertions(+), 11 deletions(-)

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



diff --git a/includes/models/CollectionBase.php 
b/includes/models/CollectionBase.php
index 4d62372..bc62222 100644
--- a/includes/models/CollectionBase.php
+++ b/includes/models/CollectionBase.php
@@ -47,18 +47,28 @@
        protected $public;
 
        /**
+        * Image that represents the collection.
+        *
+        * @var File
+        */
+       protected $image;
+
+       /**
         * @param int $id id of the collection. Null if not persisted yet
         * @param User $user User that owns the collection
         * @param string $title Title of the collection
         * @param string $description Description of the collection
         * @param boolean $public Whether the collection is public or private
+        * @param File Image that represents the collection
         */
-       public function __construct( $id = null, User $user, $title = '', 
$description = '', $public = true ) {
+       public function __construct( $id = null, User $user, $title = '', 
$description = '',
+               $public = true, $image = null) {
                $this->id = $id;
                $this->owner = $user;
                $this->title = $title;
                $this->description = $description;
                $this->public = $public;
+               $this->image = $image;
        }
 
        /**
@@ -99,13 +109,6 @@
        }
 
        /**
-        * Image that represents the collection.
-        *
-        * @var File
-        */
-       protected $image;
-
-       /**
         * Returns items count
         *
         * @return int count of items in collection
@@ -135,6 +138,7 @@
                        'title' => $this->title,
                        'description' => $this->description,
                        'public' => $this->public,
+                       'image' => $this->image->getTitle()
                );
                return $data;
        }
diff --git a/includes/stores/UserPageCollectionsList.php 
b/includes/stores/UserPageCollectionsList.php
index ec2f86d..a45db2f 100644
--- a/includes/stores/UserPageCollectionsList.php
+++ b/includes/stores/UserPageCollectionsList.php
@@ -59,7 +59,8 @@
                        User::newFromName( $json['owner'] ),
                        $json['title'],
                        $json['description'],
-                       $json['public']
+                       $json['public'],
+                       wfFindFile( $json['image'] )
                );
                $collection->setCount( $json['count'] );
                return $collection;
diff --git a/includes/stores/WatchlistCollection.php 
b/includes/stores/WatchlistCollection.php
index 5c621fa..3505416 100644
--- a/includes/stores/WatchlistCollection.php
+++ b/includes/stores/WatchlistCollection.php
@@ -65,8 +65,8 @@
                        $user,
                        wfMessage( 'gather-watchlist-title' ),
                        wfMessage( 'gather-watchlist-description' ),
-                       $firstImage,
-                       false
+                       false,
+                       $firstImage
                );
                $this->collection->batch( $items );
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaef23ff58ccacdf1d26fb158d0dcdfd3de812120
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <jhernan...@wikimedia.org>
Gerrit-Reviewer: Robmoen <rm...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to