1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 19:24:01 +02:00

[ticket/17493] Remove remnants of notify type

PHPBB-17493
This commit is contained in:
Marc Alexander
2025-04-21 15:16:41 +02:00
parent bde52e28f8
commit 3caab55e81
10 changed files with 10 additions and 46 deletions

View File

@@ -17,6 +17,10 @@ use phpbb\messenger\method\messenger_interface;
class notification_options_reconvert extends \phpbb\db\migration\migration
{
protected const NOTIFY_EMAIL = 0;
protected const NOTIFY_IM = 1;
protected const NOTIFY_BOTH = 2;
public static function depends_on()
{
return array('\phpbb\db\migration\data\v310\notifications_schema_fix');
@@ -69,12 +73,12 @@ class notification_options_reconvert extends \phpbb\db\migration\migration
// In-board notification
$notification_methods[] = '';
if ($row['user_notify_type'] == messenger_interface::NOTIFY_EMAIL || $row['user_notify_type'] == messenger_interface::NOTIFY_BOTH)
if ($row['user_notify_type'] == self::NOTIFY_EMAIL || $row['user_notify_type'] == self::NOTIFY_BOTH)
{
$notification_methods[] = 'email';
}
if ($row['user_notify_type'] == messenger_interface::NOTIFY_IM || $row['user_notify_type'] == messenger_interface::NOTIFY_BOTH)
if ($row['user_notify_type'] == self::NOTIFY_IM || $row['user_notify_type'] == self::NOTIFY_BOTH)
{
$notification_methods[] = 'jabber';
}

View File

@@ -74,14 +74,6 @@ class email extends base
/** @var AbstractTransport */
protected AbstractTransport $transport;
/**
* {@inheritDoc}
*/
public function get_id(): int
{
return self::NOTIFY_EMAIL;
}
/**
* {@inheritDoc}
*/

View File

@@ -18,22 +18,6 @@ namespace phpbb\messenger\method;
*/
interface messenger_interface
{
/** @var int Email notify method used */
public const NOTIFY_EMAIL = 0;
/** @var int Instant messaging (Jabber) notify method used */
public const NOTIFY_IM = 1;
/** @var int Both notify methods used */
public const NOTIFY_BOTH = 2;
/**
* Get messenger method id
*
* @return int
*/
public function get_id(): int;
/**
* Check if the messenger method is enabled
*

View File

@@ -136,7 +136,7 @@ class email extends \phpbb\notification\method\messenger_base
$insert_buffer->flush();
$this->notify_using_messenger(messenger_interface::NOTIFY_EMAIL);
$this->notify_using_messenger('messenger.method.email');
}
/**

View File

@@ -67,12 +67,12 @@ abstract class messenger_base extends \phpbb\notification\method\base
/**
* Notify using phpBB messenger
*
* @param int $notify_method Notify method for messenger (e.g. \phpbb\messenger\method\messenger_interface::NOTIFY_IM)
* @param string $notify_method Notify method service for messenger (e.g. 'messenger.method.email'), empty string for all available methods
* @param string $template_dir_prefix Base directory to prepend to the email template name
*
* @return void
*/
protected function notify_using_messenger($notify_method, $template_dir_prefix = '')
protected function notify_using_messenger(string $notify_method, string $template_dir_prefix = ''): void
{
if (empty($this->queue))
{
@@ -120,7 +120,7 @@ abstract class messenger_base extends \phpbb\notification\method\base
*/
foreach ($messenger_collection_iterator as $messenger_method)
{
if ($messenger_method->get_id() == $notify_method || $notify_method == $messenger_method::NOTIFY_BOTH)
if (empty($notify_method) || $messenger_collection_iterator->key() == $notify_method)
{
$messenger_method->template($notification->get_email_template(), $user['user_lang'], '', $template_dir_prefix);
$messenger_method->set_addresses($user);