X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiClearHasMsg.php;h=8667a67774c0aac386ca6bbd2865f68f79df5edd;hb=7874fc4bec845ad92960b07e969c65f3c3fe74f2;hp=32e20e80f319bff3a382c78fdc3f4a24117ea76e;hpb=5f8b92578167107e91e2b10b631de0cada0b4854;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiClearHasMsg.php b/includes/api/ApiClearHasMsg.php index 32e20e80f3..13b35772be 100644 --- a/includes/api/ApiClearHasMsg.php +++ b/includes/api/ApiClearHasMsg.php @@ -30,7 +30,13 @@ class ApiClearHasMsg extends ApiBase { public function execute() { $user = $this->getUser(); - $user->setNewtalk( false ); + if ( $this->getRequest()->wasPosted() ) { + $user->setNewtalk( false ); + } else { + DeferredUpdates::addCallableUpdate( function () use ( $user ) { + $user->setNewtalk( false ); + } ); + } $this->getResult()->addValue( null, $this->getModuleName(), 'success' ); } @@ -42,14 +48,11 @@ class ApiClearHasMsg extends ApiBase { return false; } - public function getDescription() { - return array( 'Clears the hasmsg flag for current user.' ); - } - - public function getExamples() { - return array( - 'api.php?action=clearhasmsg' => 'Clears the hasmsg flag for current user', - ); + protected function getExamplesMessages() { + return [ + 'action=clearhasmsg' + => 'apihelp-clearhasmsg-example-1', + ]; } public function getHelpUrls() {