Aaron Schulz has uploaded a new change for review.

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


Change subject: Made the grants lists look better in various places
......................................................................

Made the grants lists look better in various places

Change-Id: I1e55dcfff289eb3a3d53c76ec05f9265496ce421
---
M backend/MWOAuthConsumer.php
M backend/MWOAuthConsumerAcceptance.php
M frontend/language/MWOAuth.i18n.php
M frontend/specialpages/SpecialMWOAuthManageConsumers.php
M frontend/specialpages/SpecialMWOAuthManageMyGrants.php
M tests/testClient.php
6 files changed, 12 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth 
refs/changes/73/74673/1

diff --git a/backend/MWOAuthConsumer.php b/backend/MWOAuthConsumer.php
index 559bb4f..6a26d1c 100644
--- a/backend/MWOAuthConsumer.php
+++ b/backend/MWOAuthConsumer.php
@@ -190,6 +190,7 @@
                $this->stageTimestamp = wfTimestamp( TS_MW, 
$this->stageTimestamp );
                $this->emailAuthenticated = wfTimestamp( TS_MW, 
$this->emailAuthenticated );
                $this->deleted = (int)$this->deleted;
+               $this->grants = (array)$this->grants; // sanity
        }
 
        protected function encodeRow( DBConnRef $db, $row ) {
diff --git a/backend/MWOAuthConsumerAcceptance.php 
b/backend/MWOAuthConsumerAcceptance.php
index 3d3b5f4..f0d231b 100644
--- a/backend/MWOAuthConsumerAcceptance.php
+++ b/backend/MWOAuthConsumerAcceptance.php
@@ -90,6 +90,7 @@
                $this->userId = (int)$this->userId;
                $this->consumerId = (int)$this->consumerId;
                $this->accepted = wfTimestamp( TS_MW, $this->accepted );
+               $this->grants = (array)$this->grants; // sanity
        }
 
        protected function encodeRow( DBConnRef $db, $row ) {
diff --git a/frontend/language/MWOAuth.i18n.php 
b/frontend/language/MWOAuth.i18n.php
index d913e39..0e89c28 100644
--- a/frontend/language/MWOAuth.i18n.php
+++ b/frontend/language/MWOAuth.i18n.php
@@ -30,7 +30,6 @@
        'mwoauth-consumer-description' => 'Application description:',
        'mwoauth-consumer-callbackurl' => 'OAuth "callback" URL:',
        'mwoauth-consumer-grantsneeded' => 'Applicable grants:',
-       'mwoauth-consumer-grantsneeded-json' => 'Applicable grants (JSON):',
        'mwoauth-consumer-required-grant' => 'Applicable to consumer',
        'mwoauth-consumer-wiki' => 'Applicable wiki:',
        'mwoauth-consumer-restrictions' => 'Usage restrictions:',
@@ -235,9 +234,6 @@
        'mwoauth-consumer-callbackurl' => 'Used as label for the "Callback URL" 
input box.
 
 See [[w:Callback (computer programming)]].',
-       'mwoauth-consumer-grantsneeded-json' => 'Used as label for the textarea.
-
-The value is written in JSON format.',
        'mwoauth-consumer-wiki' => 'Used as label for the input box. The 
default value for the input box is "*".
 {{Identical|Applicable wiki}}',
        'mwoauth-consumer-restrictions' => 'Used as label for the textarea. 
(The value is written in JSON format.)
diff --git a/frontend/specialpages/SpecialMWOAuthManageConsumers.php 
b/frontend/specialpages/SpecialMWOAuthManageConsumers.php
index 806da80..2c00d82 100644
--- a/frontend/specialpages/SpecialMWOAuthManageConsumers.php
+++ b/frontend/specialpages/SpecialMWOAuthManageConsumers.php
@@ -204,6 +204,7 @@
                global $wgMemc;
 
                $user = $this->getUser();
+               $lang = $this->getLanguage();
                $dbr = MWOAuthUtils::getCentralDB( DB_SLAVE );
                $cmr = MWOAuthDAOAccessControl::wrap(
                        MWOAuthConsumer::newFromKey( $dbr, $consumerKey ), 
$this->getContext() );
@@ -270,8 +271,11 @@
                                ),
                                'grants'  => array(
                                        'type' => 'info',
-                                       'label-message' => 
'mwoauth-consumer-grantsneeded-json',
-                                       'default' => $cmr->get( 'grants', 
array( 'FormatJSON', 'encode' ) ),
+                                       'label-message' => 
'mwoauth-consumer-grantsneeded',
+                                       'default' => $cmr->get( 'grants', 
function( $grants ) use ( $lang ) {
+                                               return $lang->semicolonList(
+                                                       array_map( 
'MWOAuthUtils::grantName', $grants ) );
+                                       } ),
                                        'rows' => 5
                                ),
                                'email' => array(
diff --git a/frontend/specialpages/SpecialMWOAuthManageMyGrants.php 
b/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
index 922221b..cbe8f18 100644
--- a/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
+++ b/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
@@ -264,9 +264,10 @@
                                        return $lang->truncate( $s, 10024 ); } 
),
                        'mwoauthmanagemygrants-wiki' => $cmr->get( 'wiki' ),
                        'mwoauthmanagemygrants-wikiallowed' => $cmra->get( 
'wiki' ),
-                       'mwoauthmanagemygrants-grants' => $lang->commaList(
+                       'mwoauthmanagemygrants-grants' => $lang->semicolonList(
                                array_map( 'MWOAuthUtils::grantName', 
$cmr->get( 'grants' ) ) ),
-                       'mwoauthmanagemygrants-grantsallowed' => 
$lang->commaList( $cmra->get( 'grants' ) ),
+                       'mwoauthmanagemygrants-grantsallowed' => 
$lang->semicolonList(
+                               array_map( 'MWOAuthUtils::grantName', 
$cmra->get( 'grants' ) ) ),
                        'mwoauthmanagemygrants-consumerkey' => $cmr->get( 
'consumerKey' )
                );
 
diff --git a/tests/testClient.php b/tests/testClient.php
index bd3b1ae..383ea64 100644
--- a/tests/testClient.php
+++ b/tests/testClient.php
@@ -8,7 +8,7 @@
 }
 
 
-require '../lib/OAuth.php';
+require __DIR__ . '/../lib/OAuth.php';
 
 $consumerKey = 'dpf43f3p2l4k3l03';
 $consumerSecret = 'kd94hf93k423kf44';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e55dcfff289eb3a3d53c76ec05f9265496ce421
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to