From 5009ff2d60876de4b557595c23c740ec5c5acb3f Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 16 Nov 2015 11:10:04 -0500 Subject: [PATCH] CRM-13823 - Refactor CRM_Utils_Check_Message to calculate its own visibility --- CRM/Utils/Check.php | 4 ---- CRM/Utils/Check/Message.php | 22 +++------------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/CRM/Utils/Check.php b/CRM/Utils/Check.php index ed441b13ba..b0ad2a14f4 100644 --- a/CRM/Utils/Check.php +++ b/CRM/Utils/Check.php @@ -207,10 +207,6 @@ class CRM_Utils_Check { CRM_Utils_Hook::check($messages); - foreach ($messages as $key => $message) { - $hush = self::checkHushSnooze($message); - $messages[$key]->setVisible(!$hush); - } uasort($messages, array(__CLASS__, 'severitySort')); $maxSeverity = 1; diff --git a/CRM/Utils/Check/Message.php b/CRM/Utils/Check/Message.php index af24e81150..ca4efbd317 100644 --- a/CRM/Utils/Check/Message.php +++ b/CRM/Utils/Check/Message.php @@ -64,13 +64,6 @@ class CRM_Utils_Check_Message { */ private $icon; - /** - * - * @var bool - * This is used for Admin Status Page to determine hushed statuses. - */ - private $isVisible; - /** * Class constructor. * @@ -160,7 +153,7 @@ class CRM_Utils_Check_Message { 'message' => $this->message, 'title' => $this->title, 'severity' => $this->level, - 'is_visible' => $this->isVisible, + 'is_visible' => (int) $this->isVisible(), 'icon' => $this->icon, ); if (!empty($this->help)) { @@ -170,21 +163,12 @@ class CRM_Utils_Check_Message { } /** - * Getter for is visible. + * Check if message is visible or has been hidden by the user. * * @return bool */ public function isVisible() { - return $this->isVisible; - } - - /** - * Seter for is visible. - * - * @param bool $isVisible - */ - public function setVisible($isVisible) { - $this->isVisible = $isVisible ? 1 : 0; + return !CRM_Utils_Check::checkHushSnooze($this); } } -- 2.25.1