From: Aaron Schulz Date: Sat, 24 Sep 2016 03:28:21 +0000 (-0700) Subject: Avoid DBPerformance warnings in ApiClearHasMsg X-Git-Tag: 1.31.0-rc.0~5293^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=08bd9b517ecf36fb0d3ed3cc7d130572458b068e;p=lhc%2Fweb%2Fwiklou.git Avoid DBPerformance warnings in ApiClearHasMsg Change-Id: I592d0718204376276b3508bf32b9dc446a05b351 --- diff --git a/includes/api/ApiClearHasMsg.php b/includes/api/ApiClearHasMsg.php index 4ddbd040ca..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' ); }