diff --git a/Thanks.hooks.php b/Thanks.hooks.php index ed0b7acb..024e8e85 100644 --- a/Thanks.hooks.php +++ b/Thanks.hooks.php @@ -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() ); diff --git a/tests/ApiFlowThankIntegrationTest.php b/tests/ApiFlowThankIntegrationTest.php index c313da9b..5c7d91f5 100644 --- a/tests/ApiFlowThankIntegrationTest.php +++ b/tests/ApiFlowThankIntegrationTest.php @@ -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(), ) ); }