aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2012-10-29 18:09:20 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2012-10-29 18:09:20 -0500
commite549b7663da47d7518b93074e513c7e1d034bf52 (patch)
treede8b250ab18d550e597c7d093a0633a6f2004bed
parenteddb56f8426161923d8870ca5f8f899c342075db (diff)
downloadforums-e549b7663da47d7518b93074e513c7e1d034bf52.tar
forums-e549b7663da47d7518b93074e513c7e1d034bf52.tar.gz
forums-e549b7663da47d7518b93074e513c7e1d034bf52.tar.bz2
forums-e549b7663da47d7518b93074e513c7e1d034bf52.tar.xz
forums-e549b7663da47d7518b93074e513c7e1d034bf52.zip
[ticket/11103] Set basic notifications to be enabled by default
Now, if there is no row for the user in the user_notifications table, the user will receive basic notifications. If the user wishes to not receive notifications, a row must be added with notify = 0. For other methods besides the basic (e.g. email, jabber) a row must still be added with notify = 1 for them to receive notifications PHPBB3-11103
-rw-r--r--phpBB/develop/create_schema_files.php2
-rw-r--r--phpBB/includes/notification/manager.php131
-rw-r--r--phpBB/includes/notification/type/approve_post.php27
-rw-r--r--phpBB/includes/notification/type/approve_topic.php27
-rw-r--r--phpBB/includes/notification/type/base.php54
-rw-r--r--phpBB/includes/notification/type/bookmark.php23
-rw-r--r--phpBB/includes/notification/type/pm.php28
-rw-r--r--phpBB/includes/notification/type/post.php23
-rw-r--r--phpBB/includes/notification/type/post_in_queue.php27
-rw-r--r--phpBB/includes/notification/type/quote.php23
-rw-r--r--phpBB/includes/notification/type/report_pm.php27
-rw-r--r--phpBB/includes/notification/type/topic.php29
-rw-r--r--phpBB/includes/notification/type/topic_in_queue.php27
-rw-r--r--phpBB/includes/ucp/ucp_notifications.php25
-rw-r--r--phpBB/install/database_update.php46
-rw-r--r--phpBB/install/schemas/firebird_schema.sql4
-rw-r--r--phpBB/install/schemas/mssql_schema.sql6
-rw-r--r--phpBB/install/schemas/mysql_40_schema.sql4
-rw-r--r--phpBB/install/schemas/mysql_41_schema.sql4
-rw-r--r--phpBB/install/schemas/oracle_schema.sql3
-rw-r--r--phpBB/install/schemas/postgres_schema.sql2
-rw-r--r--phpBB/install/schemas/schema_data.sql5
-rw-r--r--phpBB/install/schemas/sqlite_schema.sql2
-rw-r--r--tests/mock/notification_manager.php2
-rw-r--r--tests/notification/ext/test/notification/type/test.php2
-rw-r--r--tests/notification/notification.php149
26 files changed, 219 insertions, 483 deletions
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index b0cffd167f..9b0afc241d 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -1781,6 +1781,7 @@ function get_schema_struct()
'item_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'method' => array('VCHAR:255', ''),
+ 'notify' => array('BOOL', 1),
),
'PRIMARY_KEY' => array(
'item_type',
@@ -1791,6 +1792,7 @@ function get_schema_struct()
'KEYS' => array(
'it' => array('INDEX', 'item_type'),
'uid' => array('INDEX', 'user_id'),
+ 'no' => array('INDEX', 'notify'),
),
);
diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php
index 75155c5dc3..3e816108f4 100644
--- a/phpBB/includes/notification/manager.php
+++ b/phpBB/includes/notification/manager.php
@@ -545,41 +545,57 @@ class phpbb_notification_manager
}
/**
- * Get subscriptions
+ * Get global subscriptions (item_id = 0)
*
* @param bool|int $user_id The user_id to add the subscription for (bool false for current user)
- * @param bool $only_global True to select only global subscription options (item_id = 0)
*
* @return array Subscriptions
*/
- public function get_subscriptions($user_id = false, $only_global = false)
+ public function get_global_subscriptions($user_id = false)
{
$user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id;
$subscriptions = array();
- $sql = 'SELECT *
- FROM ' . USER_NOTIFICATIONS_TABLE . '
- WHERE user_id = ' . (int) $user_id .
- (($only_global) ? ' AND item_id = 0' : '');
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
+ foreach ($this->get_subscription_types() as $group_name => $types)
{
- if ($only_global)
+ foreach ($types as $id => $type)
{
- if (!isset($subscriptions[$row['item_type']]))
+ $sql = 'SELECT method, notify
+ FROM ' . USER_NOTIFICATIONS_TABLE . '
+ WHERE user_id = ' . (int) $user_id . "
+ AND item_type = '" . $this->db->sql_escape($id) . "'
+ AND item_id = 0";
+ $result = $this->db->sql_query($sql);
+
+ $row = $this->db->sql_fetchrow($result);
+ if (!$row)
{
- $subscriptions[$row['item_type']] = array();
+ // No rows at all, default to ''
+ $subscriptions[$id] = array('');
}
+ else
+ {
+ do
+ {
+ if (!$row['notify'])
+ {
+ continue;
+ }
- $subscriptions[$row['item_type']][] = $row['method'];
- }
- else
- {
- $subscriptions[] = $row;
+ if (!isset($subscriptions[$id]))
+ {
+ $subscriptions[$id] = array();
+ }
+
+ $subscriptions[$id][] = $row['method'];
+ }
+ while ($row = $this->db->sql_fetchrow($result));
+ }
+
+ $this->db->sql_freeresult($result);
}
}
- $this->db->sql_freeresult($result);
return $subscriptions;
}
@@ -594,16 +610,45 @@ class phpbb_notification_manager
*/
public function add_subscription($item_type, $item_id = 0, $method = '', $user_id = false)
{
+ if ($method !== '')
+ {
+ $this->add_subscription($item_type, $item_type, '', $user_id);
+ }
+
$user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id;
- $sql = 'INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' .
- $this->db->sql_build_array('INSERT', array(
- 'item_type' => $item_type,
- 'item_id' => (int) $item_id,
- 'user_id' => (int) $user_id,
- 'method' => $method,
- ));
+ $sql = 'SELECT notify
+ FROM ' . USER_NOTIFICATIONS_TABLE . "
+ WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
+ AND item_id = " . (int) $item_id . '
+ AND user_id = ' .(int) $user_id . "
+ AND method = '" . $this->db->sql_escape($method) . "'";
$this->db->sql_query($sql);
+ $current = $this->db->sql_fetchfield('notify');
+ $this->db->sql_freeresult();
+
+ if ($current === false)
+ {
+ $sql = 'INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' .
+ $this->db->sql_build_array('INSERT', array(
+ 'item_type' => $item_type,
+ 'item_id' => (int) $item_id,
+ 'user_id' => (int) $user_id,
+ 'method' => $method,
+ 'notify' => 1,
+ ));
+ $this->db->sql_query($sql);
+ }
+ else if (!$current)
+ {
+ $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
+ SET notify = 1
+ WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
+ AND item_id = " . (int) $item_id . '
+ AND user_id = ' .(int) $user_id . "
+ AND method = '" . $this->db->sql_escape($method) . "'";
+ $this->db->sql_query($sql);
+ }
}
/**
@@ -618,12 +663,46 @@ class phpbb_notification_manager
{
$user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id;
- $sql = 'DELETE FROM ' . USER_NOTIFICATIONS_TABLE . "
+ // If no method, make sure that no other notification methods for this item are selected before deleting
+ if ($method === '')
+ {
+ $sql = 'SELECT COUNT(*) as count
+ FROM ' . USER_NOTIFICATIONS_TABLE . "
+ WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
+ AND item_id = " . (int) $item_id . '
+ AND user_id = ' .(int) $user_id . "
+ AND method <> ''
+ AND notify = 1";
+ $this->db->sql_query($sql);
+ $count = $this->db->sql_fetchfield('count');
+ $this->db->sql_freeresult();
+
+ if ($count)
+ {
+ return;
+ }
+ }
+
+ $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
+ SET notify = 0
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
AND item_id = " . (int) $item_id . '
AND user_id = ' .(int) $user_id . "
AND method = '" . $this->db->sql_escape($method) . "'";
$this->db->sql_query($sql);
+
+ if (!$this->db->sql_affectedrows())
+ {
+ $sql = 'INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' .
+ $this->db->sql_build_array('INSERT', array(
+ 'item_type' => $item_type,
+ 'item_id' => (int) $item_id,
+ 'user_id' => (int) $user_id,
+ 'method' => $method,
+ 'notify' => 0,
+ ));
+ $this->db->sql_query($sql);
+ }
}
/**
diff --git a/phpBB/includes/notification/type/approve_post.php b/phpBB/includes/notification/type/approve_post.php
index e08039baa9..26f56e6333 100644
--- a/phpBB/includes/notification/type/approve_post.php
+++ b/phpBB/includes/notification/type/approve_post.php
@@ -73,30 +73,9 @@ class phpbb_notification_type_approve_post extends phpbb_notification_type_post
return array();
}
- $notify_users = array();
-
- $sql = 'SELECT *
- FROM ' . USER_NOTIFICATIONS_TABLE . "
- WHERE item_type = '" . self::$notification_option['id'] . "'
- AND " . $this->db->sql_in_set('user_id', $auth_read[$post['forum_id']]['f_read']);
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
- {
- if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
- {
- continue;
- }
-
- if (!isset($rowset[$row['user_id']]))
- {
- $notify_users[$row['user_id']] = array();
- }
-
- $notify_users[$row['user_id']][] = $row['method'];
- }
- $this->db->sql_freeresult($result);
-
- return $notify_users;
+ return $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], array_merge($options, array(
+ 'item_type' => self::$notification_option['id'],
+ )));
}
/**
diff --git a/phpBB/includes/notification/type/approve_topic.php b/phpBB/includes/notification/type/approve_topic.php
index 6d3f8e60ae..78837f643d 100644
--- a/phpBB/includes/notification/type/approve_topic.php
+++ b/phpBB/includes/notification/type/approve_topic.php
@@ -73,30 +73,9 @@ class phpbb_notification_type_approve_topic extends phpbb_notification_type_topi
return array();
}
- $notify_users = array();
-
- $sql = 'SELECT *
- FROM ' . USER_NOTIFICATIONS_TABLE . "
- WHERE item_type = '" . self::$notification_option['id'] . "'
- AND " . $this->db->sql_in_set('user_id', $auth_read[$post['forum_id']]['f_read']);
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
- {
- if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
- {
- continue;
- }
-
- if (!isset($rowset[$row['user_id']]))
- {
- $notify_users[$row['user_id']] = array();
- }
-
- $notify_users[$row['user_id']][] = $row['method'];
- }
- $this->db->sql_freeresult($result);
-
- return $notify_users;
+ return $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], array_merge($options, array(
+ 'item_type' => self::$notification_option['id'],
+ )));
}
/**
diff --git a/phpBB/includes/notification/type/base.php b/phpBB/includes/notification/type/base.php
index df04dc2a49..c2c52fe8e9 100644
--- a/phpBB/includes/notification/type/base.php
+++ b/phpBB/includes/notification/type/base.php
@@ -310,26 +310,54 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
/**
* Find the users who want to receive notifications (helper)
*
- * @param array $item_id The item_id to search for
+ * @param array $user_ids User IDs to check if they want to receive notifications
+ * (Bool False to check all users besides anonymous and bots (USER_IGNORE))
*
* @return array
*/
- protected function _find_users_for_notification($item_id, $options)
+ protected function check_user_notification_options($user_ids = false, $options = array())
{
$options = array_merge(array(
'ignore_users' => array(),
+ 'item_type' => get_class($this),
+ 'item_id' => 0, // Global by default
), $options);
- $rowset = array();
+ if ($user_ids === false)
+ {
+ $user_ids = array();
+
+ $sql = 'SELECT user_id
+ FROM ' . USERS_TABLE . '
+ WHERE user_id <> ' . ANONYMOUS . '
+ AND user_type <> ' . USER_IGNORE;
+ $result = $this->db->sql_query($sql);
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $user_ids[] = $row['user_id'];
+ }
+ $this->db->sql_freeresult($result);
+ }
+
+ if (empty($user_ids))
+ {
+ return array();
+ }
+
+ $rowset = $resulting_user_ids = array();
- $sql = 'SELECT *
- FROM ' . USER_NOTIFICATIONS_TABLE . "
- WHERE item_type = '" . get_class($this) . "'
- AND item_id = " . (int) $item_id;
+ $sql = 'SELECT user_id, method, notify
+ FROM ' . USER_NOTIFICATIONS_TABLE . '
+ WHERE ' . $this->db->sql_in_set('user_id', $user_ids) . "
+ AND item_type = '" . $this->db->sql_escape($options['item_type']) . "'
+ AND item_id = " . (int) $options['item_id'];
$result = $this->db->sql_query($sql);
+
while ($row = $this->db->sql_fetchrow($result))
{
- if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
+ $resulting_user_ids[] = $row['user_id'];
+
+ if (!$row['notify'] || (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']])))
{
continue;
}
@@ -341,8 +369,18 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
$rowset[$row['user_id']][] = $row['method'];
}
+
$this->db->sql_freeresult($result);
+ foreach ($user_ids as $user_id)
+ {
+ if (!in_array($user_id, $resulting_user_ids) && !isset($options['ignore_users'][$user_id]))
+ {
+ // No rows at all for this user, default to ''
+ $rowset[$user_id] = array('');
+ }
+ }
+
return $rowset;
}
diff --git a/phpBB/includes/notification/type/bookmark.php b/phpBB/includes/notification/type/bookmark.php
index 4bbe9bbbf4..6fe00d9dd0 100644
--- a/phpBB/includes/notification/type/bookmark.php
+++ b/phpBB/includes/notification/type/bookmark.php
@@ -87,28 +87,7 @@ class phpbb_notification_type_bookmark extends phpbb_notification_type_post
return array();
}
- $notify_users = array();
-
- $sql = 'SELECT *
- FROM ' . USER_NOTIFICATIONS_TABLE . "
- WHERE item_type = '" . get_class($this) . "'
- AND " . $this->db->sql_in_set('user_id', $auth_read[$post['forum_id']]['f_read']);
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
- {
- if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
- {
- continue;
- }
-
- if (!isset($rowset[$row['user_id']]))
- {
- $notify_users[$row['user_id']] = array();
- }
-
- $notify_users[$row['user_id']][] = $row['method'];
- }
- $this->db->sql_freeresult($result);
+ $notify_users = $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options);
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
$update_notifications = array();
diff --git a/phpBB/includes/notification/type/pm.php b/phpBB/includes/notification/type/pm.php
index 697feca962..a60d022a12 100644
--- a/phpBB/includes/notification/type/pm.php
+++ b/phpBB/includes/notification/type/pm.php
@@ -80,33 +80,11 @@ class phpbb_notification_type_pm extends phpbb_notification_type_base
return array();
}
- $this->notification_manager->load_users(array_keys($pm['recipients']));
-
- $notify_users = array();
-
- $sql = 'SELECT *
- FROM ' . USER_NOTIFICATIONS_TABLE . "
- WHERE item_type = '" . get_class($this) . "'
- AND " . $this->db->sql_in_set('user_id', array_keys($pm['recipients'])) . '
- AND user_id <> ' . $pm['from_user_id'];
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
- {
- if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
- {
- continue;
- }
+ unset($pm['recipients'][$pm['from_user_id']]);
- if (!isset($rowset[$row['user_id']]))
- {
- $notify_users[$row['user_id']] = array();
- }
-
- $notify_users[$row['user_id']][] = $row['method'];
- }
- $this->db->sql_freeresult($result);
+ $this->notification_manager->load_users(array_keys($pm['recipients']));
- return $notify_users;
+ return $this->check_user_notification_options(array_keys($pm['recipients']), $options);
}
/**
diff --git a/phpBB/includes/notification/type/post.php b/phpBB/includes/notification/type/post.php
index 11202ee6e9..22fb5cd980 100644
--- a/phpBB/includes/notification/type/post.php
+++ b/phpBB/includes/notification/type/post.php
@@ -108,28 +108,7 @@ class phpbb_notification_type_post extends phpbb_notification_type_base
return array();
}
- $notify_users = array();
-
- $sql = 'SELECT *
- FROM ' . USER_NOTIFICATIONS_TABLE . "
- WHERE item_type = '" . get_class($this) . "'
- AND " . $this->db->sql_in_set('user_id', $auth_read[$post['forum_id']]['f_read']);
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
- {
- if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
- {
- continue;
- }
-
- if (!isset($rowset[$row['user_id']]))
- {
- $notify_users[$row['user_id']] = array();
- }
-
- $notify_users[$row['user_id']][] = $row['method'];
- }
- $this->db->sql_freeresult($result);
+ $notify_users = $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options);
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
$update_notifications = array();
diff --git a/phpBB/includes/notification/type/post_in_queue.php b/phpBB/includes/notification/type/post_in_queue.php
index d0f5f22e0f..e9e7c6120e 100644
--- a/phpBB/includes/notification/type/post_in_queue.php
+++ b/phpBB/includes/notification/type/post_in_queue.php
@@ -82,30 +82,9 @@ class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post
$auth_approve[$post['forum_id']] = array_unique(array_merge($auth_approve[$post['forum_id']], $auth_approve[0]));
- $notify_users = array();
-
- $sql = 'SELECT *
- FROM ' . USER_NOTIFICATIONS_TABLE . "
- WHERE item_type = '" . self::$notification_option['id'] . "'
- AND " . $this->db->sql_in_set('user_id', $auth_approve[$post['forum_id']][$this->permission]);
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
- {
- if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
- {
- continue;
- }
-
- if (!isset($rowset[$row['user_id']]))
- {
- $notify_users[$row['user_id']] = array();
- }
-
- $notify_users[$row['user_id']][] = $row['method'];
- }
- $this->db->sql_freeresult($result);
-
- return $notify_users;
+ return $this->check_user_notification_options($auth_approve[$post['forum_id']][$this->permission], array_merge($options, array(
+ 'item_type' => self::$notification_option['id'],
+ )));
}
/**
diff --git a/phpBB/includes/notification/type/quote.php b/phpBB/includes/notification/type/quote.php
index 47337b1cda..c9f0f923c1 100644
--- a/phpBB/includes/notification/type/quote.php
+++ b/phpBB/includes/notification/type/quote.php
@@ -106,28 +106,7 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post
return array();
}
- $notify_users = array();
-
- $sql = 'SELECT *
- FROM ' . USER_NOTIFICATIONS_TABLE . "
- WHERE item_type = '" . get_class($this) . "'
- AND " . $this->db->sql_in_set('user_id', $auth_read[$post['forum_id']]['f_read']);
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
- {
- if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
- {
- continue;
- }
-
- if (!isset($rowset[$row['user_id']]))
- {
- $notify_users[$row['user_id']] = array();
- }
-
- $notify_users[$row['user_id']][] = $row['method'];
- }
- $this->db->sql_freeresult($result);
+ $notify_users = $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options);
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
$update_notifications = array();
diff --git a/phpBB/includes/notification/type/report_pm.php b/phpBB/includes/notification/type/report_pm.php
index b2f514d483..7cf97402cc 100644
--- a/phpBB/includes/notification/type/report_pm.php
+++ b/phpBB/includes/notification/type/report_pm.php
@@ -96,31 +96,14 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
return array();
}
- $notify_users = array();
-
- $sql = 'SELECT *
- FROM ' . USER_NOTIFICATIONS_TABLE . "
- WHERE item_type = '" . self::$notification_option['id'] . "'
- AND " . $this->db->sql_in_set('user_id', $auth_approve[$post['forum_id']][$this->permission]) . '
- AND user_id <> ' . $this->user->data['user_id'];
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
+ if (($key = array_search($this->user->data['user_id'], $auth_approve[$post['forum_id']][$this->permission])))
{
- if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
- {
- continue;
- }
-
- if (!isset($rowset[$row['user_id']]))
- {
- $notify_users[$row['user_id']] = array();
- }
-
- $notify_users[$row['user_id']][] = $row['method'];
+ unset($auth_approve[$post['forum_id']][$this->permission][$key]);
}
- $this->db->sql_freeresult($result);
- return $notify_users;
+ return $this->check_user_notification_options($auth_approve[$post['forum_id']][$this->permission], array_merge($options, array(
+ 'item_type' => self::$notification_option['id'],
+ )));
}
/**
diff --git a/phpBB/includes/notification/type/topic.php b/phpBB/includes/notification/type/topic.php
index 99f7b5bee4..fbee650ad8 100644
--- a/phpBB/includes/notification/type/topic.php
+++ b/phpBB/includes/notification/type/topic.php
@@ -82,10 +82,6 @@ class phpbb_notification_type_topic extends phpbb_notification_type_base
'ignore_users' => array(),
), $options);
- // Let's continue to use the phpBB subscriptions system, at least for now.
- // It may not be the nicest thing, but it is already working and it would be significant work to replace it
- //$users = parent::_find_users_for_notification($phpbb_container, $topic['forum_id']);
-
$users = array();
$sql = 'SELECT user_id
@@ -112,30 +108,7 @@ class phpbb_notification_type_topic extends phpbb_notification_type_base
return array();
}
- $notify_users = array();
-
- $sql = 'SELECT *
- FROM ' . USER_NOTIFICATIONS_TABLE . "
- WHERE item_type = '" . get_class($this) . "'
- AND " . $this->db->sql_in_set('user_id', $auth_read[$topic['forum_id']]['f_read']);
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
- {
- if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
- {
- continue;
- }
-
- if (!isset($rowset[$row['user_id']]))
- {
- $notify_users[$row['user_id']] = array();
- }
-
- $notify_users[$row['user_id']][] = $row['method'];
- }
- $this->db->sql_freeresult($result);
-
- return $notify_users;
+ return $this->check_user_notification_options($auth_read[$topic['forum_id']]['f_read'], $options);
}
/**
diff --git a/phpBB/includes/notification/type/topic_in_queue.php b/phpBB/includes/notification/type/topic_in_queue.php
index f99fde4c75..66aecb0d05 100644
--- a/phpBB/includes/notification/type/topic_in_queue.php
+++ b/phpBB/includes/notification/type/topic_in_queue.php
@@ -75,30 +75,9 @@ class phpbb_notification_type_topic_in_queue extends phpbb_notification_type_top
$auth_approve[$topic['forum_id']] = array_unique(array_merge($auth_approve[$topic['forum_id']], $auth_approve[0]));
- $notify_users = array();
-
- $sql = 'SELECT *
- FROM ' . USER_NOTIFICATIONS_TABLE . "
- WHERE item_type = '" . self::$notification_option['id'] . "'
- AND " . $this->db->sql_in_set('user_id', $auth_approve[$topic['forum_id']]['m_approve']);
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
- {
- if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
- {
- continue;
- }
-
- if (!isset($rowset[$row['user_id']]))
- {
- $notify_users[$row['user_id']] = array();
- }
-
- $notify_users[$row['user_id']][] = $row['method'];
- }
- $this->db->sql_freeresult($result);
-
- return $notify_users;
+ return $this->check_user_notification_options($auth_approve[$topic['forum_id']]['m_approve'], array_merge($options, array(
+ 'item_type' => self::$notification_option['id'],
+ )));
}
/**
diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php
index 8749c88ba1..8810ac9ce6 100644
--- a/phpBB/includes/ucp/ucp_notifications.php
+++ b/phpBB/includes/ucp/ucp_notifications.php
@@ -32,7 +32,7 @@ class ucp_notifications
switch ($mode)
{
case 'notification_options':
- $subscriptions = $phpbb_notifications->get_subscriptions(false, true);
+ $subscriptions = $phpbb_notifications->get_global_subscriptions(false);
// Add/remove subscriptions
if ($request->is_set_post('submit'))
@@ -48,15 +48,6 @@ class ucp_notifications
{
foreach($subscription_types as $type => $data)
{
- if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type]))
- {
- $phpbb_notifications->add_subscription($type);
- }
- else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type]))
- {
- $phpbb_notifications->delete_subscription($type);
- }
-
foreach($notification_methods as $method)
{
if ($request->is_set_post($type . '_' . $method) && (!isset($subscriptions[$type]) || !in_array($method, $subscriptions[$type])))
@@ -68,6 +59,15 @@ class ucp_notifications
$phpbb_notifications->delete_subscription($type, 0, $method);
}
}
+
+ if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type]))
+ {
+ $phpbb_notifications->add_subscription($type);
+ }
+ else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type]))
+ {
+ $phpbb_notifications->delete_subscription($type);
+ }
}
}
@@ -78,7 +78,7 @@ class ucp_notifications
$this->output_notification_methods('notification_methods', $phpbb_notifications, $template, $user);
- $this->output_notification_types('notification_types', $phpbb_notifications, $template, $user);
+ $this->output_notification_types($subscriptions, 'notification_types', $phpbb_notifications, $template, $user);
$this->tpl_name = 'ucp_notifications';
$this->page_title = 'UCP_NOTIFICATION_OPTIONS';
@@ -165,10 +165,9 @@ class ucp_notifications
* @param phpbb_template $template
* @param phpbb_user $user
*/
- public function output_notification_types($block = 'notification_types', phpbb_notification_manager $phpbb_notifications, phpbb_template $template, phpbb_user $user)
+ public function output_notification_types($subscriptions, $block = 'notification_types', phpbb_notification_manager $phpbb_notifications, phpbb_template $template, phpbb_user $user)
{
$notification_methods = $phpbb_notifications->get_subscription_methods();
- $subscriptions = $phpbb_notifications->get_subscriptions(false, true);
foreach($phpbb_notifications->get_subscription_types() as $group => $subscription_types)
{
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 3e4edc0b8f..94a4749313 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1154,6 +1154,7 @@ function database_update_info()
'item_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'method' => array('VCHAR:255', ''),
+ 'notify' => array('BOOL', 1),
),
'PRIMARY_KEY' => array(
'item_type',
@@ -1164,6 +1165,7 @@ function database_update_info()
'KEYS' => array(
'it' => array('INDEX', 'item_type'),
'uid' => array('INDEX', 'user_id'),
+ 'no' => array('INDEX', 'notify'),
),
),
),
@@ -2755,7 +2757,7 @@ function change_database_data(&$no_updates, $version)
$config->set('site_home_text', '');
}
- if (true)//!isset($config['load_notifications']))
+ if (!isset($config['load_notifications']))
{
$config->set('load_notifications', 1);
@@ -2819,48 +2821,6 @@ function change_database_data(&$no_updates, $version)
$db->sql_freeresult($result);
}
}
-/*
- // Add default notifications
- $default_notifications = array(
- array(
- 'check' => ($config['allow_topic_notify']),
- 'item_type' => 'phpbb_notification_type_post',
- ),
- array(
- 'check' => ($config['allow_forum_notify']),
- 'item_type' => 'phpbb_notification_type_topic',
- ),
- array(
- 'check' => ($config['allow_bookmarks']),
- 'item_type' => 'phpbb_notification_type_bookmark',
- ),
- array(
- 'check' => ($config['allow_privmsg']),
- 'item_type' => 'phpbb_notification_type_pm',
- ),
- );
-
- foreach ($default_notifications as $convert_data)
- {
- if ($convert_data['check'])
- {
- $sql = 'SELECT user_id
- FROM ' . USERS_TABLE . '
- WHERE user_id <> ' . ANONYMOUS . '
- AND user_type <> ' . USER_IGNORE;
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- _sql('INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
- 'item_type' => $convert_data['item_type'],
- 'item_id' => 0,
- 'user_id' => $row['user_id'],
- 'method' => '',
- )), $errored, $error_ary);
- }
- $db->sql_freeresult($result);
- }
- }*/
}
break;
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index 5e13f98f25..4364641fe4 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -1240,13 +1240,15 @@ CREATE TABLE phpbb_user_notifications (
item_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
item_id INTEGER DEFAULT 0 NOT NULL,
user_id INTEGER DEFAULT 0 NOT NULL,
- method VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL
+ method VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
+ notify INTEGER DEFAULT 1 NOT NULL
);;
ALTER TABLE phpbb_user_notifications ADD PRIMARY KEY (item_type, item_id, user_id, method);;
CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications(item_type);;
CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications(user_id);;
+CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications(notify);;
# Table: 'phpbb_user_group'
CREATE TABLE phpbb_user_group (
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index d463afb17c..17786e27e2 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -1526,7 +1526,8 @@ CREATE TABLE [phpbb_user_notifications] (
[item_type] [varchar] (255) DEFAULT ('') NOT NULL ,
[item_id] [int] DEFAULT (0) NOT NULL ,
[user_id] [int] DEFAULT (0) NOT NULL ,
- [method] [varchar] (255) DEFAULT ('') NOT NULL
+ [method] [varchar] (255) DEFAULT ('') NOT NULL ,
+ [notify] [int] DEFAULT (1) NOT NULL
) ON [PRIMARY]
GO
@@ -1546,6 +1547,9 @@ GO
CREATE INDEX [uid] ON [phpbb_user_notifications]([user_id]) ON [PRIMARY]
GO
+CREATE INDEX [no] ON [phpbb_user_notifications]([notify]) ON [PRIMARY]
+GO
+
/*
Table: 'phpbb_user_group'
diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql
index 9272e18735..fb91d55e5f 100644
--- a/phpBB/install/schemas/mysql_40_schema.sql
+++ b/phpBB/install/schemas/mysql_40_schema.sql
@@ -877,9 +877,11 @@ CREATE TABLE phpbb_user_notifications (
item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
method varbinary(255) DEFAULT '' NOT NULL,
+ notify tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
PRIMARY KEY (item_type, item_id, user_id, method),
KEY it (item_type),
- KEY uid (user_id)
+ KEY uid (user_id),
+ KEY no (notify)
);
diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql
index a73fda41f5..3601f2a43c 100644
--- a/phpBB/install/schemas/mysql_41_schema.sql
+++ b/phpBB/install/schemas/mysql_41_schema.sql
@@ -877,9 +877,11 @@ CREATE TABLE phpbb_user_notifications (
item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
method varchar(255) DEFAULT '' NOT NULL,
+ notify tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
PRIMARY KEY (item_type, item_id, user_id, method),
KEY it (item_type),
- KEY uid (user_id)
+ KEY uid (user_id),
+ KEY no (notify)
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index 02be9566dc..15c3012e28 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -1645,6 +1645,7 @@ CREATE TABLE phpbb_user_notifications (
item_id number(8) DEFAULT '0' NOT NULL,
user_id number(8) DEFAULT '0' NOT NULL,
method varchar2(255) DEFAULT '' ,
+ notify number(1) DEFAULT '1' NOT NULL,
CONSTRAINT pk_phpbb_user_notifications PRIMARY KEY (item_type, item_id, user_id, method)
)
/
@@ -1653,6 +1654,8 @@ CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications (item_type)
/
CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications (user_id)
/
+CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications (notify)
+/
/*
Table: 'phpbb_user_group'
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 784e3c8c68..263a9884b7 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1127,11 +1127,13 @@ CREATE TABLE phpbb_user_notifications (
item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
method varchar(255) DEFAULT '' NOT NULL,
+ notify INT2 DEFAULT '1' NOT NULL CHECK (notify >= 0),
PRIMARY KEY (item_type, item_id, user_id, method)
);
CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications (item_type);
CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications (user_id);
+CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications (notify);
/*
Table: 'phpbb_user_group'
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 28f8b1c3b6..e100a1dc14 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -771,13 +771,8 @@ INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm');
# User Notification Options (for first user)
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('report', 0, 2, '');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('needs_approval', 0, 2, '');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_bookmark', 0, 2, '');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_pm', 0, 2, '');
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_post', 0, 2, '');
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_post', 0, 2, 'phpbb_notification_method_email');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_quote', 0, 2, '');
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_topic', 0, 2, '');
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_topic', 0, 2, 'phpbb_notification_method_email');
diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql
index 2fdac43947..1ca904e3bd 100644
--- a/phpBB/install/schemas/sqlite_schema.sql
+++ b/phpBB/install/schemas/sqlite_schema.sql
@@ -850,11 +850,13 @@ CREATE TABLE phpbb_user_notifications (
item_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
method varchar(255) NOT NULL DEFAULT '',
+ notify INTEGER UNSIGNED NOT NULL DEFAULT '1',
PRIMARY KEY (item_type, item_id, user_id, method)
);
CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications (item_type);
CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications (user_id);
+CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications (notify);
# Table: 'phpbb_user_group'
CREATE TABLE phpbb_user_group (
diff --git a/tests/mock/notification_manager.php b/tests/mock/notification_manager.php
index 388be3a28c..47fe30730f 100644
--- a/tests/mock/notification_manager.php
+++ b/tests/mock/notification_manager.php
@@ -70,7 +70,7 @@ class phpbb_mock_notification_manager
}
- public function get_subscriptions()
+ public function get_global_subscriptions()
{
return array();
}
diff --git a/tests/notification/ext/test/notification/type/test.php b/tests/notification/ext/test/notification/type/test.php
index e76bdb5e0c..34149484df 100644
--- a/tests/notification/ext/test/notification/type/test.php
+++ b/tests/notification/ext/test/notification/type/test.php
@@ -29,7 +29,7 @@ class phpbb_ext_test_notification_type_test extends phpbb_notification_type_base
public function find_users_for_notification($post, $options = array())
{
- return $this->_find_users_for_notification(0, $options);
+ return $this->check_user_notification_options(array(0), $options);
}
public function create_insert_array($post, $pre_create_data = array())
diff --git a/tests/notification/notification.php b/tests/notification/notification.php
index bb671e62ef..4bacc2a954 100644
--- a/tests/notification/notification.php
+++ b/tests/notification/notification.php
@@ -119,159 +119,19 @@ class phpbb_notification_test extends phpbb_database_test_case
public function test_subscriptions()
{
- $this->notifications->add_subscription('phpbb_notification_type_post', 0, '');
- $this->notifications->add_subscription('phpbb_notification_type_post', 0, '', 1);
- $this->notifications->add_subscription('phpbb_notification_type_quote', 0, '', 1);
-
- $this->notifications->add_subscription('phpbb_notification_type_post', 0, '', 2);
- $this->notifications->add_subscription('phpbb_notification_type_post', 0, 'email', 2);
- $this->notifications->add_subscription('phpbb_notification_type_post', 0, 'jabber', 2);
- $this->notifications->add_subscription('phpbb_notification_type_post', 1, '', 2);
- $this->notifications->add_subscription('phpbb_notification_type_post', 1, 'email', 2);
- $this->notifications->add_subscription('phpbb_notification_type_post', 1, 'jabber', 2);
- $this->notifications->add_subscription('phpbb_notification_type_post', 2, '', 2);
- $this->notifications->add_subscription('phpbb_notification_type_post', 2, 'email', 2);
- $this->notifications->add_subscription('phpbb_notification_type_post', 2, 'jabber', 2);
-
- $this->assertEquals(array(
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 0,
- 'user_id' => 0,
- 'method' => '',
- ),
- ), $this->notifications->get_subscriptions());
-
- $this->assertEquals(array(
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 0,
- 'user_id' => 1,
- 'method' => '',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_quote',
- 'item_id' => 0,
- 'user_id' => 1,
- 'method' => '',
- ),
- ), $this->notifications->get_subscriptions(1));
-
- $this->assertEquals(array(
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 0,
- 'user_id' => 2,
- 'method' => '',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 0,
- 'user_id' => 2,
- 'method' => 'email',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 0,
- 'user_id' => 2,
- 'method' => 'jabber',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 1,
- 'user_id' => 2,
- 'method' => '',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 1,
- 'user_id' => 2,
- 'method' => 'email',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 1,
- 'user_id' => 2,
- 'method' => 'jabber',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 2,
- 'user_id' => 2,
- 'method' => '',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 2,
- 'user_id' => 2,
- 'method' => 'email',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 2,
- 'user_id' => 2,
- 'method' => 'jabber',
- ),
- ), $this->notifications->get_subscriptions(2));
+ $this->notifications->delete_subscription('phpbb_notification_type_post', 0, '', 2);
- $this->assertEquals(array(
- 'phpbb_notification_type_post' => array(
- '',
- 'email',
- 'jabber',
- ),
- ), $this->notifications->get_subscriptions(2, true));
+ $this->assertArrayNotHasKey('phpbb_notification_type_post', $this->notifications->get_global_subscriptions(2));
- $this->notifications->delete_subscription('phpbb_notification_type_post', 0, '', 2);
- $this->notifications->delete_subscription('phpbb_notification_type_post', 1, 'email', 2);
- $this->notifications->delete_subscription('phpbb_notification_type_post', 2, 'jabber', 2);
+ $this->notifications->add_subscription('phpbb_notification_type_post', 0, '', 2);
- $this->assertEquals(array(
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 0,
- 'user_id' => 2,
- 'method' => 'email',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 0,
- 'user_id' => 2,
- 'method' => 'jabber',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 1,
- 'user_id' => 2,
- 'method' => '',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 1,
- 'user_id' => 2,
- 'method' => 'jabber',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 2,
- 'user_id' => 2,
- 'method' => '',
- ),
- array(
- 'item_type' => 'phpbb_notification_type_post',
- 'item_id' => 2,
- 'user_id' => 2,
- 'method' => 'email',
- ),
- ), $this->notifications->get_subscriptions(2));
+ $this->assertArrayHasKey('phpbb_notification_type_post', $this->notifications->get_global_subscriptions(2));
}
public function test_notifications()
{
global $db;
- $this->notifications->add_subscription('phpbb_ext_test_notification_type_test');
-
// Used to test post notifications later
$db->sql_query('INSERT INTO ' . TOPICS_WATCH_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'topic_id' => 2,
@@ -320,7 +180,6 @@ class phpbb_notification_test extends phpbb_database_test_case
'topic_id' => 2,
'user_id' => 0,
)));
- $this->notifications->add_subscription('phpbb_notification_type_bookmark');
$this->notifications->add_notifications(array('phpbb_notification_type_quote', 'phpbb_notification_type_bookmark', 'phpbb_notification_type_post', 'phpbb_ext_test_notification_type_test'), array(
'post_id' => '5',