jenkins-bot has submitted this change and it was merged.
Change subject: Link rights to OAuth/grants instead of tooltips
......................................................................
Link rights to OAuth/grants instead of tooltips
Link each grant to the full description on OAuth/grants, instead of
compressing it into a single tooltip.
Bug: 55672
Change-Id: I73f28ffc9bdab3cdef7c0508abb9a26b7cba5a27
---
M backend/MWOAuthUtils.php
M frontend/specialpages/SpecialMWOAuthConsumerRegistration.php
M frontend/specialpages/SpecialMWOAuthManageMyGrants.php
3 files changed, 17 insertions(+), 15 deletions(-)
Approvals:
Aaron Schulz: Looks good to me, approved
jenkins-bot: Verified
diff --git a/backend/MWOAuthUtils.php b/backend/MWOAuthUtils.php
index 35dc53d..ecaef07 100644
--- a/backend/MWOAuthUtils.php
+++ b/backend/MWOAuthUtils.php
@@ -471,4 +471,18 @@
return $wgOAuthSecretKey ? hash_hmac( 'sha1', $secret,
$wgOAuthSecretKey ) : $secret;
}
+
+ /**
+ * Generate a link to Special:OAuth/grants for a particular grant name.
+ * This should be used to link end users to a full description of what
+ * rights they are giving when they authorize a grant.
+ * @param string $grant the grant name
+ * @return string (proto-relative) HTML link
+ */
+ public static function getGrantsLink( $grant ) {
+ return Linker::linkKnown(
+ SpecialPage::getTitleFor( 'OAuth', 'grants', $grant ),
+ htmlspecialchars( self::grantName( $grant ) )
+ );
+ }
}
diff --git a/frontend/specialpages/SpecialMWOAuthConsumerRegistration.php
b/frontend/specialpages/SpecialMWOAuthConsumerRegistration.php
index 4557b60..5ff69f5 100644
--- a/frontend/specialpages/SpecialMWOAuthConsumerRegistration.php
+++ b/frontend/specialpages/SpecialMWOAuthConsumerRegistration.php
@@ -131,8 +131,7 @@
$this->msg(
'mwoauth-consumer-required-grant' )->escaped() => 'grant'
),
'rows' => array_combine(
- array_map(
'htmlspecialchars',
-
MWOAuthUtils::grantNames( MWOAuthUtils::getValidGrants() ) ),
+ array_map(
'MWOAuthUtils::getGrantsLink', MWOAuthUtils::getValidGrants() ),
MWOAuthUtils::getValidGrants()
),
'tooltips' => array_combine(
diff --git a/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
b/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
index bf150db..c188ee5 100644
--- a/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
+++ b/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
@@ -157,7 +157,7 @@
'usedOnWiki' => array(
'type' => 'info',
'label-message' =>
'mwoauth-consumer-wiki',
- 'default' => $cmr->get( 'wiki',
'MWOAuthUtils::getWikiIdName' )
+ 'default' => $cmra->get( 'wiki',
'MWOAuthUtils::getWikiIdName' )
),
'grants' => array(
'type' => 'checkmatrix',
@@ -166,23 +166,12 @@
$this->msg(
'mwoauthmanagemygrants-grantaccept' )->escaped() => 'grant'
),
'rows' => array_combine(
- array_map( 'htmlspecialchars',
-
MWOAuthUtils::grantNames( $cmr->get( 'grants' ) ) ),
+ array_map(
'MWOAuthUtils::getGrantsLink', $cmr->get( 'grants' ) ),
$cmr->get( 'grants' )
),
'default' => array_map(
function( $g ) { return
"grant-$g"; },
$cmra->get( 'grants' )
- ),
- 'tooltips' => array_combine(
- array_map(
'MWOAuthUtils::grantName', MWOAuthUtils::getValidGrants() ),
- array_map(
- function( $rights ) use
( $lang ) {
- return
$lang->semicolonList( array_map(
-
'User::getRightDescription', $rights ) );
- },
-
MWOAuthUtils::getRightsByGrant()
- )
),
'force-options-on' => array_map(
function( $g ) { return
"grant-$g"; },
--
To view, visit https://gerrit.wikimedia.org/r/93901
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I73f28ffc9bdab3cdef7c0508abb9a26b7cba5a27
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: CSteipp <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits