1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

[ticket/11444] Moving the in-board notifications to a method class

Currently the in-board method for the notifications is hardcoded and
cannot be disabled. This method should be in his own class extending
`phpbb\notification\method\method_interface`.

It also add the possibility, for each method, to be enabled by default (ie:
no entry in the DB => notification enabled).

https://tracker.phpbb.com/browse/PHPBB3-11444
https://tracker.phpbb.com/browse/PHPBB3-11967

PHPBB3-11444
This commit is contained in:
Nicofuma
2014-04-28 14:00:27 +02:00
committed by Tristan Darricau
parent 58d1d37c16
commit be0d4e20d4
55 changed files with 1229 additions and 609 deletions

View File

@@ -20,7 +20,7 @@ class ucp_notifications_info
'title' => 'UCP_NOTIFICATION_OPTIONS',
'modes' => array(
'notification_options' => array('title' => 'UCP_NOTIFICATION_OPTIONS', 'auth' => '', 'cat' => array('UCP_PREFS')),
'notification_list' => array('title' => 'UCP_NOTIFICATION_LIST', 'auth' => '', 'cat' => array('UCP_MAIN')),
'notification_list' => array('title' => 'UCP_NOTIFICATION_LIST', 'auth' => 'cfg_allow_board_notifications', 'cat' => array('UCP_MAIN')),
),
);
}

View File

@@ -70,15 +70,6 @@ class ucp_notifications
$phpbb_notifications->delete_subscription($type, 0, $method_data['id']);
}
}
if ($request->is_set_post(str_replace('.', '_', $type) . '_notification') && !isset($subscriptions[$type]))
{
$phpbb_notifications->add_subscription($type);
}
else if (!$request->is_set_post(str_replace('.', '_', $type) . '_notification') && isset($subscriptions[$type]))
{
$phpbb_notifications->delete_subscription($type);
}
}
}
@@ -100,7 +91,7 @@ class ucp_notifications
// Mark all items read
if ($request->variable('mark', '') == 'all' && check_link_hash($request->variable('token', ''), 'mark_all_notifications_read'))
{
$phpbb_notifications->mark_notifications_read(false, false, $user->data['user_id'], $form_time);
$phpbb_notifications->mark_notifications(false, false, $user->data['user_id'], $form_time);
meta_refresh(3, $this->u_action);
$message = $user->lang['NOTIFICATIONS_MARK_ALL_READ_SUCCESS'];
@@ -131,11 +122,11 @@ class ucp_notifications
if (!empty($mark_read))
{
$phpbb_notifications->mark_notifications_read_by_id($mark_read, $form_time);
$phpbb_notifications->mark_notifications_by_id($mark_read, $form_time);
}
}
$notifications = $phpbb_notifications->load_notifications(array(
$notifications = $phpbb_notifications->load_notifications('notification.method.board', array(
'start' => $start,
'limit' => $config['topics_per_page'],
'count_total' => true,
@@ -196,8 +187,6 @@ class ucp_notifications
'NAME' => $user->lang($data['lang']),
'EXPLAIN' => (isset($user->lang[$data['lang'] . '_EXPLAIN'])) ? $user->lang($data['lang'] . '_EXPLAIN') : '',
'SUBSCRIBED' => (isset($subscriptions[$type])) ? true : false,
));
foreach ($notification_methods as $method => $method_data)
@@ -230,7 +219,7 @@ class ucp_notifications
{
$notification_methods = $phpbb_notifications->get_subscription_methods();
foreach ($notification_methods as $method => $method_data)
foreach($notification_methods as $method => $method_data)
{
$template->assign_block_vars($block, array(
'METHOD' => $method_data['id'],