mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Thanks
synced 2024-11-15 02:54:23 +00:00
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:
parent
d9def310b3
commit
dfb639af3e
|
@ -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()
|
||||
);
|
||||
|
|
|
@ -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(),
|
||||
) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue