From: Coleman Watts Date: Tue, 17 Nov 2015 20:25:10 +0000 (-0500) Subject: Avoid duplicate statusPreference checks X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a82f003ad337f258ae316be715707e32a6e3f4db;p=civicrm-core.git Avoid duplicate statusPreference checks --- diff --git a/CRM/Utils/Check/Message.php b/CRM/Utils/Check/Message.php index a3640928c1..d673091b29 100644 --- a/CRM/Utils/Check/Message.php +++ b/CRM/Utils/Check/Message.php @@ -64,6 +64,12 @@ class CRM_Utils_Check_Message { */ private $icon; + /** + * @var bool + * Has this message been suppressed? + */ + private $isVisible; + /** * @var bool|string * Date this message is hidden until @@ -173,15 +179,20 @@ class CRM_Utils_Check_Message { } /** - * Return message visibility. + * Get message visibility. * * @return bool */ public function isVisible() { - return !$this->checkStatusPreference(); + if (!isset($this->isVisible)) { + $this->isVisible = !$this->checkStatusPreference(); + } + return $this->isVisible; } /** + * Get date hidden until. + * * @return string */ public function getHiddenUntil() { @@ -194,6 +205,8 @@ class CRM_Utils_Check_Message { /** * Check if message is visible or has been hidden by the user. * + * Also populates this->hiddenUntil property. + * * @return bool * TRUE means hidden, FALSE means visible. * @throws \CiviCRM_API3_Exception