From 8f60a2481fae0c29c905e921c2754a190fb1afe1 Mon Sep 17 00:00:00 2001 From: michel160 Date: Wed, 21 Aug 2013 00:39:09 +0200 Subject: [PATCH] Update AbstractUserNotificationEvent.class.php Permissions and options for events should be evaluated by default (may be overwritten by derived classes) Currently notification settings for conversations are displayed even if module is disabled (not to speak about problems with my own optional notifications) --- .../AbstractUserNotificationEvent.class.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php index d5f9c97499..39e1ce5191 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php @@ -82,6 +82,30 @@ abstract class AbstractUserNotificationEvent extends DatabaseObjectDecorator imp * @see wcf\system\user\notification\event\IUserNotificationEvent::isVisible() */ public function isVisible() { + if ($this->options) { + $hasEnabledOption = false; + $options = explode(',', strtoupper($this->options)); + foreach ($options as $option) { + if (defined($option) && constant($option)) { + $hasEnabledOption = true; + break; + } + } + if (!$hasEnabledOption) return false; + } + + $hasPermission = true; + if ($this->permissions) { + $hasPermission = false; + $permissions = explode(',', $this->permissions); + foreach ($permissions as $permission) { + if (WCF::getSession()->getPermission($permission)) { + $hasPermission = true; + break; + } + } + } + if (!$hasPermission) return false; return true; } -- 2.20.1