From 91f82f386f4d8729ece8de22c16d971cf9695d53 Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 28 Nov 2024 13:05:01 +0700 Subject: [PATCH 1/4] [ticket/17445] Don't require email templates presence for webpush notifications PHPBB-17445 --- phpBB/phpbb/notification/method/webpush.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/notification/method/webpush.php b/phpBB/phpbb/notification/method/webpush.php index 9d19cb2200..56d280deec 100644 --- a/phpBB/phpbb/notification/method/webpush.php +++ b/phpBB/phpbb/notification/method/webpush.php @@ -93,7 +93,7 @@ class webpush extends messenger_base implements extended_method_interface */ public function is_available(type_interface $notification_type = null): bool { - return parent::is_available($notification_type) && $this->config['webpush_enable'] + return $this->config['webpush_enable'] && !empty($this->config['webpush_vapid_public']) && !empty($this->config['webpush_vapid_private']); } From 637eaf03fb82d7bea70b4e5131972e1dd4b6b65b Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 28 Nov 2024 22:28:22 +0700 Subject: [PATCH 2/4] [ticket/17445] Adjust code logic PHPBB-17445 --- phpBB/phpbb/notification/method/webpush.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/notification/method/webpush.php b/phpBB/phpbb/notification/method/webpush.php index 56d280deec..7110460821 100644 --- a/phpBB/phpbb/notification/method/webpush.php +++ b/phpBB/phpbb/notification/method/webpush.php @@ -94,7 +94,8 @@ class webpush extends messenger_base implements extended_method_interface public function is_available(type_interface $notification_type = null): bool { return $this->config['webpush_enable'] - && !empty($this->config['webpush_vapid_public']) && !empty($this->config['webpush_vapid_private']); + && $this->config['webpush_vapid_public'] + && $this->config['webpush_vapid_private']; } /** From c2c9e4e6b0d94ac4e9ff2fdd21d24e33e079d31b Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 30 Nov 2024 11:10:23 +0700 Subject: [PATCH 3/4] [ticket/17445] Inherit from base rather than from of message_base PHPBB-17445 --- phpBB/phpbb/notification/method/webpush.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/notification/method/webpush.php b/phpBB/phpbb/notification/method/webpush.php index 7110460821..94e5dfa20f 100644 --- a/phpBB/phpbb/notification/method/webpush.php +++ b/phpBB/phpbb/notification/method/webpush.php @@ -28,7 +28,7 @@ use phpbb\user_loader; * This class handles sending push messages for notifications */ -class webpush extends messenger_base implements extended_method_interface +class webpush extends base implements extended_method_interface { /** @var config */ protected $config; @@ -70,12 +70,13 @@ class webpush extends messenger_base implements extended_method_interface public function __construct(config $config, driver_interface $db, log_interface $log, user_loader $user_loader, user $user, string $phpbb_root_path, string $php_ext, string $notification_webpush_table, string $push_subscriptions_table) { - parent::__construct($user_loader, $phpbb_root_path, $php_ext); - $this->config = $config; $this->db = $db; $this->log = $log; + $this->user_loader = $user_loader; $this->user = $user; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; $this->notification_webpush_table = $notification_webpush_table; $this->push_subscriptions_table = $push_subscriptions_table; } From 8619ff35268365852bd71b4e80f87cbb917c67be Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 30 Nov 2024 11:46:16 +0700 Subject: [PATCH 4/4] [ticket/17445] Add missing class property definitions PHPBB-17445 --- phpBB/phpbb/notification/method/webpush.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/phpBB/phpbb/notification/method/webpush.php b/phpBB/phpbb/notification/method/webpush.php index 94e5dfa20f..25b22d54d8 100644 --- a/phpBB/phpbb/notification/method/webpush.php +++ b/phpBB/phpbb/notification/method/webpush.php @@ -39,9 +39,18 @@ class webpush extends base implements extended_method_interface /** @var log_interface */ protected $log; + /** @var user_loader */ + protected $user_loader; + /** @var user */ protected $user; + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + /** @var string Notification Web Push table */ protected $notification_webpush_table;