mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-18 22:41:28 +02:00
[ticket/9837] Display unapproved posts to their authors
Coding guidelines fixes PHPBB3-9837
This commit is contained in:
@@ -24,8 +24,8 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te
|
||||
// data set 0: display_unapproved_posts=false, moderator, can see all posts
|
||||
array(
|
||||
'phpbb_posts',
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
'post', 1, '',
|
||||
array(
|
||||
array('m_approve', 1, true),
|
||||
@@ -37,11 +37,11 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te
|
||||
array('post_id' => 4),
|
||||
),
|
||||
),
|
||||
// data set 1: display_unapproved_posts=false, normal user, cannot see any unapproved posts
|
||||
// data set 1: display_unapproved_posts=false, normal user, cannot see any unapproved posts
|
||||
array(
|
||||
'phpbb_posts',
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
'post', 1, '',
|
||||
array(
|
||||
),
|
||||
@@ -53,7 +53,7 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te
|
||||
array(
|
||||
'phpbb_topics',
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
'topic', 1, '',
|
||||
array(
|
||||
array('m_approve', 1, true),
|
||||
@@ -65,22 +65,22 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te
|
||||
array('topic_id' => 4),
|
||||
),
|
||||
),
|
||||
// data set 3: display_unapproved_posts=false, normal user, cannot see unapproved posts topic
|
||||
// data set 3: display_unapproved_posts=false, normal user, cannot see unapproved posts topic
|
||||
array(
|
||||
'phpbb_topics',
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
'topic', 1, '',
|
||||
array(),
|
||||
array(
|
||||
array('topic_id' => 2),
|
||||
),
|
||||
),
|
||||
// data set 4: display_unapproved_posts=true, guest user, cannot see unapproved posts
|
||||
// data set 4: display_unapproved_posts=true, guest user, cannot see unapproved posts
|
||||
array(
|
||||
'phpbb_posts',
|
||||
1,
|
||||
true,
|
||||
true,
|
||||
'post', 1, '',
|
||||
array(
|
||||
),
|
||||
@@ -88,22 +88,22 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te
|
||||
array('post_id' => 2),
|
||||
),
|
||||
),
|
||||
// data set 5: display_unapproved_posts=true, guest user, cannot see unapproved posts topic
|
||||
// data set 5: display_unapproved_posts=true, guest user, cannot see unapproved posts topic
|
||||
array(
|
||||
'phpbb_topics',
|
||||
1,
|
||||
true,
|
||||
true,
|
||||
'topic', 1, '',
|
||||
array(),
|
||||
array(
|
||||
array('topic_id' => 2),
|
||||
),
|
||||
),
|
||||
// data set 6: display_unapproved_posts=true, normal user, can see own unapproved posts
|
||||
// data set 6: display_unapproved_posts=true, normal user, can see own unapproved posts
|
||||
array(
|
||||
'phpbb_posts',
|
||||
0,
|
||||
true,
|
||||
0,
|
||||
true,
|
||||
'post', 1, '',
|
||||
array(),
|
||||
array(
|
||||
@@ -111,11 +111,11 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te
|
||||
array('post_id' => 2),
|
||||
),
|
||||
),
|
||||
// data set 7: display_unapproved_posts=true, normal user, can see own unapproved posts topic
|
||||
// data set 7: display_unapproved_posts=true, normal user, can see own unapproved posts topic
|
||||
array(
|
||||
'phpbb_topics',
|
||||
0,
|
||||
true,
|
||||
true,
|
||||
'topic', 1, '',
|
||||
array(),
|
||||
array(
|
||||
@@ -152,11 +152,13 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$content_visibility = new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
|
||||
|
||||
$result = $db->sql_query('SELECT ' . $mode . '_id
|
||||
$sql = 'SELECT ' . $mode . '_id
|
||||
FROM ' . $table . '
|
||||
WHERE ' . $content_visibility->get_visibility_sql($mode, $forum_id, $table_alias) . '
|
||||
ORDER BY ' . $mode . '_id ASC');
|
||||
ORDER BY ' . $mode . '_id ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$this->assertEquals($expected, $db->sql_fetchrowset($result));
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user