From a82f003ad337f258ae316be715707e32a6e3f4db Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 17 Nov 2015 15:25:10 -0500 Subject: [PATCH] Avoid duplicate statusPreference checks --- CRM/Utils/Check/Message.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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 -- 2.25.1