From 959525cebe5ea921268a9ab1b62ebc19df9dca9b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 5 Oct 2012 12:05:22 +0200 Subject: [PATCH] [feature/soft-delete] Merge functionality of m_approve and m_restore The problems with having two different permissions are just too big and cause huge queries, if they are granted differently. Also it's quite hard to decide what should happen when a moderator has only one permission and the topic has only posts of the two hidden types. To avoid all this, we merge them so it's a simple switch: either the user is a moderator, then he can see all posts, or he is not, then he can only see approved ones. PHPBB3-9567 --- .../get_forums_visibility_sql_test.php | 10 +--- .../get_global_visibility_sql_test.php | 10 +--- .../get_visibility_sql_test.php | 46 ------------------- 3 files changed, 4 insertions(+), 62 deletions(-) diff --git a/tests/content_visibility/get_forums_visibility_sql_test.php b/tests/content_visibility/get_forums_visibility_sql_test.php index 6960e43687..840f247b14 100644 --- a/tests/content_visibility/get_forums_visibility_sql_test.php +++ b/tests/content_visibility/get_forums_visibility_sql_test.php @@ -22,7 +22,6 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data 'topic', array(1, 2, 3), '', array( array('m_approve', true, array(1 => true, 2 => true, 3 => true)), - array('m_restore', true, array(1 => true, 2 => true, 3 => true)), ), array( array('topic_id' => 1), @@ -41,7 +40,6 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data 'topic', array(1, 2), '', array( array('m_approve', true, array(1 => true, 2 => true, 3 => true)), - array('m_restore', true, array(1 => true, 2 => true, 3 => true)), ), array( array('topic_id' => 1), @@ -57,13 +55,12 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data 'topic', array(1, 2, 3), '', array( array('m_approve', true, array(2 => true)), - array('m_restore', true, array(1 => true)), ), array( array('topic_id' => 2), - array('topic_id' => 3), array('topic_id' => 4), array('topic_id' => 5), + array('topic_id' => 6), array('topic_id' => 8), ), ), @@ -72,7 +69,6 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data 'post', array(1, 2, 3), '', array( array('m_approve', true, array(1 => true, 2 => true, 3 => true)), - array('m_restore', true, array(1 => true, 2 => true, 3 => true)), ), array( array('post_id' => 1), @@ -91,7 +87,6 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data 'post', array(1, 2), '', array( array('m_approve', true, array(1 => true, 2 => true, 3 => true)), - array('m_restore', true, array(1 => true, 2 => true, 3 => true)), ), array( array('post_id' => 1), @@ -107,13 +102,12 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data 'post', array(1, 2, 3), '', array( array('m_approve', true, array(2 => true)), - array('m_restore', true, array(1 => true)), ), array( array('post_id' => 2), - array('post_id' => 3), array('post_id' => 4), array('post_id' => 5), + array('post_id' => 6), array('post_id' => 8), ), ), diff --git a/tests/content_visibility/get_global_visibility_sql_test.php b/tests/content_visibility/get_global_visibility_sql_test.php index ac8b4225cd..8b96b3954d 100644 --- a/tests/content_visibility/get_global_visibility_sql_test.php +++ b/tests/content_visibility/get_global_visibility_sql_test.php @@ -22,7 +22,6 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data 'topic', array(), '', array( array('m_approve', true, array(1 => true, 2 => true, 3 => true)), - array('m_restore', true, array(1 => true, 2 => true, 3 => true)), ), array( array('topic_id' => 1), @@ -41,7 +40,6 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data 'topic', array(3), '', array( array('m_approve', true, array(1 => true, 2 => true, 3 => true)), - array('m_restore', true, array(1 => true, 2 => true, 3 => true)), ), array( array('topic_id' => 1), @@ -57,13 +55,12 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data 'topic', array(), '', array( array('m_approve', true, array(2 => true)), - array('m_restore', true, array(1 => true)), ), array( array('topic_id' => 2), - array('topic_id' => 3), array('topic_id' => 4), array('topic_id' => 5), + array('topic_id' => 6), array('topic_id' => 8), ), ), @@ -72,7 +69,6 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data 'post', array(), '', array( array('m_approve', true, array(1 => true, 2 => true, 3 => true)), - array('m_restore', true, array(1 => true, 2 => true, 3 => true)), ), array( array('post_id' => 1), @@ -91,7 +87,6 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data 'post', array(3), '', array( array('m_approve', true, array(1 => true, 2 => true, 3 => true)), - array('m_restore', true, array(1 => true, 2 => true, 3 => true)), ), array( array('post_id' => 1), @@ -107,13 +102,12 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data 'post', array(), '', array( array('m_approve', true, array(2 => true)), - array('m_restore', true, array(1 => true)), ), array( array('post_id' => 2), - array('post_id' => 3), array('post_id' => 4), array('post_id' => 5), + array('post_id' => 6), array('post_id' => 8), ), ), diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php index 16a38e5f46..3c837b2837 100644 --- a/tests/content_visibility/get_visibility_sql_test.php +++ b/tests/content_visibility/get_visibility_sql_test.php @@ -22,7 +22,6 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te 'post', 1, '', array( array('m_approve', 1, true), - array('m_restore', 1, true), ), array( array('post_id' => 1), @@ -34,44 +33,9 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te 'phpbb_posts', 'post', 1, '', array( - array('m_approve', 1, true), - ), - array( - array('post_id' => 1), - array('post_id' => 2), - ), - ), - array( - 'phpbb_posts', - 'post', 1, '', - array( - array('m_restore', 1, true), ), array( array('post_id' => 2), - array('post_id' => 3), - ), - ), - array( - 'phpbb_posts', - 'post', 1, '', - array( - ), - array( - array('post_id' => 2), - ), - ), - array( - 'phpbb_topics', - 'topic', 1, '', - array( - array('m_approve', 1, true), - array('m_restore', 1, true), - ), - array( - array('topic_id' => 1), - array('topic_id' => 2), - array('topic_id' => 3), ), ), array( @@ -83,16 +47,6 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te array( array('topic_id' => 1), array('topic_id' => 2), - ), - ), - array( - 'phpbb_topics', - 'topic', 1, '', - array( - array('m_restore', 1, true), - ), - array( - array('topic_id' => 2), array('topic_id' => 3), ), ),