Jhernandez has uploaded a new change for review.
https://gerrit.wikimedia.org/r/197955
Change subject: Fix api usage (was causing fetching a collection to fail)
......................................................................
Fix api usage (was causing fetching a collection to fail)
As an anonymous user now calling the list=lists without lstids or lstowner
results
in api usage error.
Bug: T93222
Change-Id: Ia69eb411a9349bebdb587726d4c7fefed25fadde
---
M includes/models/Collection.php
1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather
refs/changes/55/197955/1
diff --git a/includes/models/Collection.php b/includes/models/Collection.php
index 4dd6fc1..db4c6cd 100644
--- a/includes/models/Collection.php
+++ b/includes/models/Collection.php
@@ -109,6 +109,7 @@
$api = new ApiMain( new FauxRequest( array(
'action' => 'query',
'list' => 'lists',
+ 'lstids' => $id,
'lstprop' => 'label|description|public|image',
'prop' => 'pageimages|extracts',
'generator' => 'listpages',
@@ -122,17 +123,16 @@
// TODO: Pagination
'continue' => '',
) ) );
+
try {
$api->execute();
$data = $api->getResultData();
if ( isset( $data['query']['lists'] ) ) {
$lists = $data['query']['lists'];
- // FIXME: Use lstids=$id in the query lists
when bug T92865 is resolved
- foreach ( $lists as $list ) {
- if ( $list['id'] === $id ) {
- $collection = new Collection(
$id, $user, $list['label'], $list['description'],
- $list['public'],
$list['image'] );
- }
+ if ( count( $lists ) === 1 ) {
+ $list = $lists[0];
+ $collection = new Collection( $id,
$user, $list['label'], $list['description'],
+ $list['public'], $list['image']
);
}
}
--
To view, visit https://gerrit.wikimedia.org/r/197955
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia69eb411a9349bebdb587726d4c7fefed25fadde
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits