mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
[feature/soft-delete] Add unit tests for get_forums_visibility_sql()
PHPBB3-9657
This commit is contained in:
@@ -82,12 +82,13 @@ class phpbb_content_visibility
|
||||
* @param $table_alias string - Table alias to prefix in SQL queries
|
||||
* @return string with the appropriate combination SQL logic for topic/post_visibility
|
||||
*/
|
||||
static public function get_visibility_sql_forums($mode, $forum_ids = array(), $table_alias = '')
|
||||
static public function get_forums_visibility_sql($mode, $forum_ids = array(), $table_alias = '')
|
||||
{
|
||||
global $auth, $db, $user;
|
||||
|
||||
// users can always see approved posts
|
||||
$where_sql = "($table_alias{$mode}_visibility = " . ITEM_APPROVED;
|
||||
$where_sql = "(($table_alias{$mode}_visibility = " . ITEM_APPROVED . '
|
||||
AND ' . $db->sql_in_set($table_alias . 'forum_id', $forum_ids) . ')';
|
||||
|
||||
// in set notation: {approve_forums} = {m_approve} - {exclude_forums}
|
||||
$approve_forums = array_intersect($forum_ids, array_keys($auth->acl_getf('m_approve', true)));
|
||||
|
@@ -1003,7 +1003,7 @@ function display_user_activity(&$userdata)
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE poster_id = ' . $userdata['user_id'] . '
|
||||
AND post_postcount = 1
|
||||
AND ' . phpbb_content_visibility::get_visibility_sql_forums('post', $forum_ary) . '
|
||||
AND ' . phpbb_content_visibility::get_forums_visibility_sql('post', $forum_ary) . '
|
||||
GROUP BY forum_id
|
||||
ORDER BY num_posts DESC';
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
@@ -1029,7 +1029,7 @@ function display_user_activity(&$userdata)
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE poster_id = ' . $userdata['user_id'] . '
|
||||
AND post_postcount = 1
|
||||
AND ' . phpbb_content_visibility::get_visibility_sql_forums('post', $forum_ary) . '
|
||||
AND ' . phpbb_content_visibility::get_forums_visibility_sql('post', $forum_ary) . '
|
||||
GROUP BY topic_id
|
||||
ORDER BY num_posts DESC';
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
|
Reference in New Issue
Block a user