[MediaWiki-commits] [Gerrit] mediawiki...ReadingLists[master]: Fix type conversion bug

2017-10-26 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/379702 )

Change subject: Fix type conversion bug
..


Fix type conversion bug

And also some small type / code style issues while we are at it.

Change-Id: Ic5a62b2665b2b25fc270770c3d9db088bcc9fd00
---
M src/Api/ApiQueryReadingLists.php
M src/Api/ApiTrait.php
M src/ReadingListRepository.php
3 files changed, 5 insertions(+), 5 deletions(-)

Approvals:
  Krinkle: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Mholloway: Looks good to me, approved



diff --git a/src/Api/ApiQueryReadingLists.php b/src/Api/ApiQueryReadingLists.php
index 2a0ff1b..68c9d89 100644
--- a/src/Api/ApiQueryReadingLists.php
+++ b/src/Api/ApiQueryReadingLists.php
@@ -190,14 +190,14 @@
 
/**
 * Transform a row into an API result item
-* @param ReadingListRow $row
+* @param ReadingListRow $row List row, with additions from 
addExtraData().
 * @param string $mode One of the MODE_* constants.
 * @return array
 */
private function getResultItem( $row, $mode ) {
$item = [
'id' => (int)$row->rl_id,
-   'name' => (int)$row->rl_name,
+   'name' => $row->rl_name,
'default' => (bool)$row->rl_is_default,
'description' => $row->rl_description,
'color' => $row->rl_color,
diff --git a/src/Api/ApiTrait.php b/src/Api/ApiTrait.php
index 4af09f5..df2e7c9 100644
--- a/src/Api/ApiTrait.php
+++ b/src/Api/ApiTrait.php
@@ -40,7 +40,7 @@
 */
public static function factory( ApiBase $parent, $name ) {
$services = MediaWikiServices::getInstance();
-   $loadBalancerFactory = $services ->getDBLoadBalancerFactory();
+   $loadBalancerFactory = $services->getDBLoadBalancerFactory();
$dbw = Utils::getDB( DB_MASTER, $services );
$dbr = Utils::getDB( DB_REPLICA, $services );
if ( static::$prefix ) {
diff --git a/src/ReadingListRepository.php b/src/ReadingListRepository.php
index c657907..4bd7e89 100644
--- a/src/ReadingListRepository.php
+++ b/src/ReadingListRepository.php
@@ -531,7 +531,7 @@
if ( !$ids ) {
throw new ReadingListRepositoryException( 
'readinglists-db-error-not-set-up' );
}
-   return $ids;
+   return array_map( 'intval', $ids );
}
 
/**
@@ -645,7 +645,7 @@
}
}
 
-   return $ids;
+   return array_map( 'intval', $ids );
}
 
/**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic5a62b2665b2b25fc270770c3d9db088bcc9fd00
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/ReadingLists
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza 
Gerrit-Reviewer: BearND 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: Mholloway 
Gerrit-Reviewer: Thiemo Mättig (WMDE) 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...ReadingLists[master]: Fix type conversion bug

2017-09-21 Thread Code Review
Gergő Tisza has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/379702 )

Change subject: Fix type conversion bug
..

Fix type conversion bug

And also some small type / code style issues while we are at it.

Change-Id: Ic5a62b2665b2b25fc270770c3d9db088bcc9fd00
---
M src/Api/ApiQueryReadingListOrder.php
M src/Api/ApiQueryReadingLists.php
M src/Api/ApiTrait.php
3 files changed, 6 insertions(+), 4 deletions(-)


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

diff --git a/src/Api/ApiQueryReadingListOrder.php 
b/src/Api/ApiQueryReadingListOrder.php
index 9bb78f0..7eab123 100644
--- a/src/Api/ApiQueryReadingListOrder.php
+++ b/src/Api/ApiQueryReadingListOrder.php
@@ -40,11 +40,13 @@
$repository = $this->getReadingListRepository( 
$this->getUser() );
if ( $listorder ) {
$order = $repository->getListOrder();
+   $order = array_map( 'intval', $order );
ApiResult::setIndexedTagName( $order, 'list' );
$result->addValue( $path, null, [ 'type' => 
'lists', 'order' => $order ] );
}
foreach ( $lists as $list ) {
$order = $repository->getListEntryOrder( $list 
);
+   $order = array_map( 'intval', $order );
ApiResult::setIndexedTagName( $order, 'entry' );
$result->addValue( $path, null, [ 'type' => 
'entries', 'list' => $list, 'order' => $order ] );
}
diff --git a/src/Api/ApiQueryReadingLists.php b/src/Api/ApiQueryReadingLists.php
index 48bdb93..350ca89 100644
--- a/src/Api/ApiQueryReadingLists.php
+++ b/src/Api/ApiQueryReadingLists.php
@@ -197,7 +197,7 @@
private function getResultItem( $row, $mode ) {
$item = [
'id' => (int)$row->rl_id,
-   'name' => (int)$row->rl_name,
+   'name' => $row->rl_name,
'default' => (bool)$row->rl_is_default,
'description' => $row->rl_description,
'color' => $row->rl_color,
@@ -210,10 +210,10 @@
$item['deleted'] = (bool)$row->rl_deleted;
}
if ( isset( $row->order ) ) {
-   $item['order'] = $row->order;
+   $item['order'] = array_map( 'intval', $row->order );
}
if ( isset( $row->list_order ) ) {
-   $item['listOrder'] = $row->list_order;
+   $item['listOrder'] = array_map( 'intval', 
$row->list_order );
}
return $item;
}
diff --git a/src/Api/ApiTrait.php b/src/Api/ApiTrait.php
index bb7dd13..830b17a 100644
--- a/src/Api/ApiTrait.php
+++ b/src/Api/ApiTrait.php
@@ -47,7 +47,7 @@
 */
public static function factory( ApiBase $parent, $name ) {
$services = MediaWikiServices::getInstance();
-   $loadBalancerFactory = $services ->getDBLoadBalancerFactory();
+   $loadBalancerFactory = $services->getDBLoadBalancerFactory();
$dbw = Utils::getDB( DB_MASTER, $services );
$dbr = Utils::getDB( DB_REPLICA, $services );
if ( static::$prefix ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5a62b2665b2b25fc270770c3d9db088bcc9fd00
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ReadingLists
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza 

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