mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/17493] Remove remnants of notify type
PHPBB-17493
This commit is contained in:
parent
bde52e28f8
commit
3caab55e81
10 changed files with 10 additions and 46 deletions
|
@ -1784,9 +1784,6 @@ class acp_users
|
||||||
'MASS_EMAIL' => $data['massemail'],
|
'MASS_EMAIL' => $data['massemail'],
|
||||||
'ALLOW_PM' => $data['allowpm'],
|
'ALLOW_PM' => $data['allowpm'],
|
||||||
'HIDE_ONLINE' => $data['hideonline'],
|
'HIDE_ONLINE' => $data['hideonline'],
|
||||||
'NOTIFY_EMAIL' => ($data['notifymethod'] == messenger_interface::NOTIFY_EMAIL) ? true : false,
|
|
||||||
'NOTIFY_IM' => ($data['notifymethod'] == messenger_interface::NOTIFY_IM) ? true : false,
|
|
||||||
'NOTIFY_BOTH' => ($data['notifymethod'] == messenger_interface::NOTIFY_BOTH) ? true : false,
|
|
||||||
'NOTIFY_PM' => $data['notifypm'],
|
'NOTIFY_PM' => $data['notifypm'],
|
||||||
'BBCODE' => $data['bbcode'],
|
'BBCODE' => $data['bbcode'],
|
||||||
'SMILIES' => $data['smilies'],
|
'SMILIES' => $data['smilies'],
|
||||||
|
|
|
@ -119,14 +119,6 @@ define('POST_STICKY', 1);
|
||||||
define('POST_ANNOUNCE', 2);
|
define('POST_ANNOUNCE', 2);
|
||||||
define('POST_GLOBAL', 3);
|
define('POST_GLOBAL', 3);
|
||||||
|
|
||||||
// Notify methods
|
|
||||||
/** @deprecated 4.0.0-a1 Replaced by \phpbb\messenger\method\messenger_interface::NOTIFY_EMAIL, to be removed in 5.0.0-a1 */
|
|
||||||
define('NOTIFY_EMAIL', 0);
|
|
||||||
/** @deprecated 4.0.0-a1 Replaced by \phpbb\messenger\method\messenger_interface::NOTIFY_IM, to be removed in 5.0.0-a1 */
|
|
||||||
define('NOTIFY_IM', 1);
|
|
||||||
/** @deprecated 4.0.0-a1 Replaced by \phpbb\messenger\method\messenger_interface::NOTIFY_BOTH, to be removed in 5.0.0-a1 */
|
|
||||||
define('NOTIFY_BOTH', 2);
|
|
||||||
|
|
||||||
// Notify status
|
// Notify status
|
||||||
define('NOTIFY_YES', 0);
|
define('NOTIFY_YES', 0);
|
||||||
define('NOTIFY_NO', 1);
|
define('NOTIFY_NO', 1);
|
||||||
|
|
|
@ -176,9 +176,6 @@ class ucp_prefs
|
||||||
$template->assign_vars([
|
$template->assign_vars([
|
||||||
'ERROR' => (count($error)) ? implode('<br />', $error) : '',
|
'ERROR' => (count($error)) ? implode('<br />', $error) : '',
|
||||||
|
|
||||||
'S_NOTIFY_EMAIL' => ($data['notifymethod'] == messenger_interface::NOTIFY_EMAIL) ? true : false,
|
|
||||||
'S_NOTIFY_IM' => ($data['notifymethod'] == messenger_interface::NOTIFY_IM) ? true : false,
|
|
||||||
'S_NOTIFY_BOTH' => ($data['notifymethod'] == messenger_interface::NOTIFY_BOTH) ? true : false,
|
|
||||||
'S_VIEW_EMAIL' => $data['viewemail'],
|
'S_VIEW_EMAIL' => $data['viewemail'],
|
||||||
'S_MASS_EMAIL' => $data['massemail'],
|
'S_MASS_EMAIL' => $data['massemail'],
|
||||||
'S_ALLOW_PM' => $data['allowpm'],
|
'S_ALLOW_PM' => $data['allowpm'],
|
||||||
|
|
|
@ -937,7 +937,6 @@ if (!$get_info)
|
||||||
array('user_emailtime', 'users.user_emailtime', 'null_to_zero'),
|
array('user_emailtime', 'users.user_emailtime', 'null_to_zero'),
|
||||||
array('user_notify', 'users.user_notify', 'intval'),
|
array('user_notify', 'users.user_notify', 'intval'),
|
||||||
array('user_notify_pm', 'users.user_notify_pm', 'intval'),
|
array('user_notify_pm', 'users.user_notify_pm', 'intval'),
|
||||||
array('user_notify_type', $messenger_method::NOTIFY_EMAIL, ''),
|
|
||||||
array('user_allow_pm', 'users.user_allow_pm', 'intval'),
|
array('user_allow_pm', 'users.user_allow_pm', 'intval'),
|
||||||
array('user_allow_viewonline', 'users.user_allow_viewonline', 'intval'),
|
array('user_allow_viewonline', 'users.user_allow_viewonline', 'intval'),
|
||||||
array('user_allow_viewemail', 'users.user_viewemail', 'intval'),
|
array('user_allow_viewemail', 'users.user_viewemail', 'intval'),
|
||||||
|
|
|
@ -17,6 +17,10 @@ use phpbb\messenger\method\messenger_interface;
|
||||||
|
|
||||||
class notification_options_reconvert extends \phpbb\db\migration\migration
|
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()
|
public static function depends_on()
|
||||||
{
|
{
|
||||||
return array('\phpbb\db\migration\data\v310\notifications_schema_fix');
|
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
|
// In-board notification
|
||||||
$notification_methods[] = '';
|
$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';
|
$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';
|
$notification_methods[] = 'jabber';
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,14 +74,6 @@ class email extends base
|
||||||
/** @var AbstractTransport */
|
/** @var AbstractTransport */
|
||||||
protected AbstractTransport $transport;
|
protected AbstractTransport $transport;
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function get_id(): int
|
|
||||||
{
|
|
||||||
return self::NOTIFY_EMAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,22 +18,6 @@ namespace phpbb\messenger\method;
|
||||||
*/
|
*/
|
||||||
interface messenger_interface
|
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
|
* Check if the messenger method is enabled
|
||||||
*
|
*
|
||||||
|
|
|
@ -136,7 +136,7 @@ class email extends \phpbb\notification\method\messenger_base
|
||||||
|
|
||||||
$insert_buffer->flush();
|
$insert_buffer->flush();
|
||||||
|
|
||||||
$this->notify_using_messenger(messenger_interface::NOTIFY_EMAIL);
|
$this->notify_using_messenger('messenger.method.email');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -67,12 +67,12 @@ abstract class messenger_base extends \phpbb\notification\method\base
|
||||||
/**
|
/**
|
||||||
* Notify using phpBB messenger
|
* 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
|
* @param string $template_dir_prefix Base directory to prepend to the email template name
|
||||||
*
|
*
|
||||||
* @return void
|
* @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))
|
if (empty($this->queue))
|
||||||
{
|
{
|
||||||
|
@ -120,7 +120,7 @@ abstract class messenger_base extends \phpbb\notification\method\base
|
||||||
*/
|
*/
|
||||||
foreach ($messenger_collection_iterator as $messenger_method)
|
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->template($notification->get_email_template(), $user['user_lang'], '', $template_dir_prefix);
|
||||||
$messenger_method->set_addresses($user);
|
$messenger_method->set_addresses($user);
|
||||||
|
|
|
@ -119,7 +119,6 @@ class phpbb_messenger_method_email_test extends \phpbb_test_case
|
||||||
|
|
||||||
public function test_miscellaneous(): void
|
public function test_miscellaneous(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals(email::NOTIFY_EMAIL, $this->method_email->get_id());
|
|
||||||
$this->assertEquals('email', $this->method_email->get_queue_object_name());
|
$this->assertEquals('email', $this->method_email->get_queue_object_name());
|
||||||
$this->assertFalse($this->method_email->is_enabled());
|
$this->assertFalse($this->method_email->is_enabled());
|
||||||
$this->config->offsetSet('email_enable', true);
|
$this->config->offsetSet('email_enable', true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue