Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/202286
Change subject: Hygiene: Add support to Collection model for hidden status
......................................................................
Hygiene: Add support to Collection model for hidden status
Change-Id: Ib7e0a55e2c5c0b8f7ad40299990a1aa4d0c8cabe
---
M includes/models/Collection.php
M includes/models/CollectionBase.php
M includes/models/CollectionsList.php
3 files changed, 29 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather
refs/changes/86/202286/1
diff --git a/includes/models/Collection.php b/includes/models/Collection.php
index 04687d6..adcbd58 100644
--- a/includes/models/Collection.php
+++ b/includes/models/Collection.php
@@ -186,6 +186,9 @@
$owner = User::newFromName(
$list['owner'] );
$collection = new Collection( $id,
$owner, $list['label'], $list['description'],
$list['public'], $image );
+ if ( $list['perm'] === 'hidden' ) {
+ $collection->setHidden();
+ }
}
}
diff --git a/includes/models/CollectionBase.php
b/includes/models/CollectionBase.php
index ccbf6d2..944109f 100644
--- a/includes/models/CollectionBase.php
+++ b/includes/models/CollectionBase.php
@@ -47,6 +47,13 @@
protected $public;
/**
+ * Whether collection has been hidden
+ *
+ * @var bool
+ */
+ protected $hidden;
+
+ /**
* Image that represents the collection.
*
* @var File
@@ -117,6 +124,22 @@
}
/**
+ * Marks the collection as hidden.
+ */
+ public function setHidden() {
+ $this->hidden = true;
+ }
+
+ /**
+ * Returns if the list has been hidden by an admin.
+ *
+ * @return boolean
+ */
+ public function isHidden() {
+ return $this->hidden;
+ }
+
+ /**
* Returns items count
*
* @return int count of items in collection
diff --git a/includes/models/CollectionsList.php
b/includes/models/CollectionsList.php
index 3f5a56b..4ba464d 100644
--- a/includes/models/CollectionsList.php
+++ b/includes/models/CollectionsList.php
@@ -154,6 +154,9 @@
$info = new models\CollectionInfo(
$list['id'], $user,
$list['label'],
$list['description'], $list['public'], $image );
$info->setCount( $list['count'] );
+ if ( $list['perm'] === 'hidden' ) {
+ $info->setHidden();
+ }
if ( $memberTitle ) {
$info->setMember( $memberTitle,
$list['title'] );
}
--
To view, visit https://gerrit.wikimedia.org/r/202286
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib7e0a55e2c5c0b8f7ad40299990a1aa4d0c8cabe
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