Call getAlphadecimal() directly

Relying on UUID::__toString() now triggers a notice, causing
unrelated patches to fail. This patch addresses the issue.

Change-Id: Ia94826a0e600adf8afd5908af75772b596ab8d0a
This commit is contained in:
wctaiwan 2014-04-14 23:36:13 -04:00 committed by EBernhardson
parent d9def310b3
commit dfb639af3e
2 changed files with 8 additions and 6 deletions

View file

@ -324,8 +324,10 @@ class ThanksHooks {
$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 ThanksHooks {
'class' => $cssActiveClass,
'href' => '#', // TODO: No-javascript fallback
'title' => $tooltip,
'data-post-id' => $post->getPostId()
'data-post-id' => $uuid
),
wfMessage( 'thanks-button-thank', $user )->escaped()
);

View file

@ -109,7 +109,7 @@ class ApiFlowThankTest extends ApiTestCase {
$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 @@ class ApiFlowThankTest extends ApiTestCase {
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 @@ class ApiFlowThankTest extends ApiTestCase {
$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 @@ class ApiFlowThankTest extends ApiTestCase {
$this->setExpectedException( 'UsageException', 'You cannot thank yourself' );
list( $result,, ) = $this->doApiRequestWithToken( array(
'action' => 'flowthank',
'postid' => $this->postByMe->getPostId(),
'postid' => $this->postByMe->getPostId()->getAlphadecimal(),
) );
}