mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
Merge pull request #6755 from rxu/ticket/17445
[ticket/17445] Don't require email templates presence for webpush notifications
This commit is contained in:
commit
1d2a798358
1 changed files with 16 additions and 5 deletions
|
@ -28,7 +28,7 @@ use phpbb\user_loader;
|
||||||
* This class handles sending push messages for notifications
|
* 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 */
|
/** @var config */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
@ -39,9 +39,18 @@ class webpush extends messenger_base implements extended_method_interface
|
||||||
/** @var log_interface */
|
/** @var log_interface */
|
||||||
protected $log;
|
protected $log;
|
||||||
|
|
||||||
|
/** @var user_loader */
|
||||||
|
protected $user_loader;
|
||||||
|
|
||||||
/** @var user */
|
/** @var user */
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $phpbb_root_path;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $php_ext;
|
||||||
|
|
||||||
/** @var string Notification Web Push table */
|
/** @var string Notification Web Push table */
|
||||||
protected $notification_webpush_table;
|
protected $notification_webpush_table;
|
||||||
|
|
||||||
|
@ -70,12 +79,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,
|
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)
|
string $php_ext, string $notification_webpush_table, string $push_subscriptions_table)
|
||||||
{
|
{
|
||||||
parent::__construct($user_loader, $phpbb_root_path, $php_ext);
|
|
||||||
|
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->log = $log;
|
$this->log = $log;
|
||||||
|
$this->user_loader = $user_loader;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
$this->php_ext = $php_ext;
|
||||||
$this->notification_webpush_table = $notification_webpush_table;
|
$this->notification_webpush_table = $notification_webpush_table;
|
||||||
$this->push_subscriptions_table = $push_subscriptions_table;
|
$this->push_subscriptions_table = $push_subscriptions_table;
|
||||||
}
|
}
|
||||||
|
@ -93,8 +103,9 @@ class webpush extends messenger_base implements extended_method_interface
|
||||||
*/
|
*/
|
||||||
public function is_available(type_interface $notification_type = null): bool
|
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']);
|
&& $this->config['webpush_vapid_public']
|
||||||
|
&& $this->config['webpush_vapid_private'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue