X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiClearHasMsg.php;h=99242a8b0dba32542bfab650b229e5d43adcc5ce;hb=d58ba34ea04c6874432ebd09b58797588777e0ca;hp=4ddbd040ca87dac8fe89784460c0f40107b8ef9c;hpb=a85d1b9d0cd7f02111d3a647d5b91e3b1f334563;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiClearHasMsg.php b/includes/api/ApiClearHasMsg.php index 4ddbd040ca..99242a8b0d 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' ); } @@ -39,7 +45,7 @@ class ApiClearHasMsg extends ApiBase { } public function mustBePosted() { - return false; + return true; } protected function getExamplesMessages() {