From 08bd9b517ecf36fb0d3ed3cc7d130572458b068e Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 23 Sep 2016 20:28:21 -0700 Subject: [PATCH] Avoid DBPerformance warnings in ApiClearHasMsg Change-Id: I592d0718204376276b3508bf32b9dc446a05b351 --- includes/api/ApiClearHasMsg.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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' ); } -- 2.20.1