jenkins-bot has submitted this change and it was merged.
Change subject: Call getAlphadecimal() directly
......................................................................
Call getAlphadecimal() directly
Relying on UUID::__toString() now triggers a notice, causing
unrelated patches to fail. This patch addresses the issue.
Change-Id: Ia94826a0e600adf8afd5908af75772b596ab8d0a
---
M Thanks.hooks.php
M tests/ApiFlowThankIntegrationTest.php
2 files changed, 8 insertions(+), 6 deletions(-)
Approvals:
EBernhardson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/Thanks.hooks.php b/Thanks.hooks.php
index ed0b7ac..024e8e8 100644
--- a/Thanks.hooks.php
+++ b/Thanks.hooks.php
@@ -324,8 +324,10 @@
$cssActiveClass = 'mw-thanks-flow-thank-link mw-ui-button
mw-ui-quiet mw-ui-constructive';
$cssInactiveClass = 'mw-thanks-flow-thanked mw-ui-button
mw-ui-quiet mw-ui-disabled';
+ $uuid = $post->getPostId()->getAlphadecimal();
+
// User has already thanked for revision
- if ( $user->getRequest()->getSessionData(
"flow-thanked-{$post->getPostId()}" ) ) {
+ if ( $user->getRequest()->getSessionData(
"flow-thanked-{$uuid}" ) ) {
return Html::rawElement(
'span',
array( 'class' => $cssInactiveClass ),
@@ -344,7 +346,7 @@
'class' => $cssActiveClass,
'href' => '#', // TODO: No-javascript fallback
'title' => $tooltip,
- 'data-post-id' => $post->getPostId()
+ 'data-post-id' => $uuid
),
wfMessage( 'thanks-button-thank', $user )->escaped()
);
diff --git a/tests/ApiFlowThankIntegrationTest.php
b/tests/ApiFlowThankIntegrationTest.php
index c313da9..5c7d91f 100644
--- a/tests/ApiFlowThankIntegrationTest.php
+++ b/tests/ApiFlowThankIntegrationTest.php
@@ -109,7 +109,7 @@
$this->setExpectedException( 'UsageException', 'The token
parameter must be set' );
$this->doApiRequest( array(
'action' => 'flowthank',
- 'postid' => UUID::create( '42' ),
+ 'postid' => UUID::create( '42' )->getAlphadecimal(),
) );
}
@@ -121,7 +121,7 @@
public function testValidRequest(){
list( $result,, ) = $this->doApiRequestWithToken( array(
'action' => 'flowthank',
- 'postid' => $this->postByOtherUser->getPostId(),
+ 'postid' =>
$this->postByOtherUser->getPostId()->getAlphadecimal(),
) );
$this->assertSuccess( $result );
}
@@ -130,7 +130,7 @@
$this->setExpectedException( 'UsageException', 'Post ID is
invalid' );
list( $result,, ) = $this->doApiRequestWithToken( array(
'action' => 'flowthank',
- 'postid' => UUID::create( '42' ),
+ 'postid' => UUID::create( '42' )->getAlphadecimal(),
) );
}
@@ -138,7 +138,7 @@
$this->setExpectedException( 'UsageException', 'You cannot
thank yourself' );
list( $result,, ) = $this->doApiRequestWithToken( array(
'action' => 'flowthank',
- 'postid' => $this->postByMe->getPostId(),
+ 'postid' =>
$this->postByMe->getPostId()->getAlphadecimal(),
) );
}
--
To view, visit https://gerrit.wikimedia.org/r/125938
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia94826a0e600adf8afd5908af75772b596ab8d0a
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Thanks
Gerrit-Branch: master
Gerrit-Owner: Wctaiwan <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits