diff --git a/data/config.ini b/data/config.ini index 43862b33..e91559b8 100644 --- a/data/config.ini +++ b/data/config.ini @@ -14,7 +14,6 @@ salt = "1A2/$_4xVa" [misc] featuredPostMaxDays=7 debugQueries=0 -logAnonymousUploads=1 githubLink = http://github.com/rr-/szurubooru [help] @@ -54,6 +53,11 @@ minLength = 5 maxLength = 2000 commentsPerPage = 10 maxCommentsInList = 5 +needEmailForCommenting = 0 + +[uploads] +needEmailForUploading = 1 +logAnonymousUploads=1 [registration] staffActivation = 0 @@ -64,8 +68,6 @@ userNameMaxLength = 20 userNameRegex = "/^[\w_-]+$/ui" needEmailForRegistering = 1 -needEmailForCommenting = 0 -needEmailForUploading = 1 confirmationEmailEnabled = 1 confirmationEmailSenderName = "{host} mailing system" confirmationEmailSenderEmail = "noreply@{host}" diff --git a/src/Api/Jobs/CommentJobs/AddCommentJob.php b/src/Api/Jobs/CommentJobs/AddCommentJob.php index 4356673d..e701419e 100644 --- a/src/Api/Jobs/CommentJobs/AddCommentJob.php +++ b/src/Api/Jobs/CommentJobs/AddCommentJob.php @@ -52,6 +52,6 @@ class AddCommentJob extends AbstractJob public function isConfirmedEmailRequired() { - return Core::getConfig()->registration->needEmailForCommenting; + return Core::getConfig()->comments->needEmailForCommenting; } } diff --git a/src/Api/Jobs/CommentJobs/PreviewCommentJob.php b/src/Api/Jobs/CommentJobs/PreviewCommentJob.php index 52e47151..dc48e22e 100644 --- a/src/Api/Jobs/CommentJobs/PreviewCommentJob.php +++ b/src/Api/Jobs/CommentJobs/PreviewCommentJob.php @@ -58,6 +58,6 @@ class PreviewCommentJob extends AbstractJob public function isConfirmedEmailRequired() { - return Core::getConfig()->registration->needEmailForCommenting; + return Core::getConfig()->comments->needEmailForCommenting; } } diff --git a/src/Api/Jobs/PostJobs/AddPostJob.php b/src/Api/Jobs/PostJobs/AddPostJob.php index 4f7b2dcf..09fab51c 100644 --- a/src/Api/Jobs/PostJobs/AddPostJob.php +++ b/src/Api/Jobs/PostJobs/AddPostJob.php @@ -48,7 +48,7 @@ class AddPostJob extends AbstractJob PostModel::save($post); Logger::log('{user} added {post} (tags: {tags}, safety: {safety}, source: {source})', [ - 'user' => ($anonymous and !Core::getConfig()->misc->logAnonymousUploads) + 'user' => ($anonymous and !Core::getConfig()->uploads->logAnonymousUploads) ? TextHelper::reprUser(UserModel::getAnonymousName()) : TextHelper::reprUser(Auth::getCurrentUser()), 'post' => TextHelper::reprPost($post), @@ -83,6 +83,6 @@ class AddPostJob extends AbstractJob public function isConfirmedEmailRequired() { - return Core::getConfig()->registration->needEmailForUploading; + return Core::getConfig()->uploads->needEmailForUploading; } } diff --git a/tests/Tests/ApiTests/ApiAuthTest.php b/tests/Tests/ApiTests/ApiAuthTest.php index e8ee7402..c506bab1 100644 --- a/tests/Tests/ApiTests/ApiAuthTest.php +++ b/tests/Tests/ApiTests/ApiAuthTest.php @@ -61,7 +61,7 @@ class ApiAuthTest extends AbstractFullApiTest public function testAuthEnforcing() { - Core::getConfig()->registration->needEmailForCommenting = false; + Core::getConfig()->comments->needEmailForCommenting = false; $this->grantAccess('addComment'); $comment = $this->commentMocker->mockSingle(); diff --git a/tests/Tests/ApiTests/ApiEmailRequirementsTest.php b/tests/Tests/ApiTests/ApiEmailRequirementsTest.php index 5c14c960..51e35966 100644 --- a/tests/Tests/ApiTests/ApiEmailRequirementsTest.php +++ b/tests/Tests/ApiTests/ApiEmailRequirementsTest.php @@ -3,8 +3,8 @@ class ApiEmailRequirementsTest extends AbstractFullApiTest { public function testRegularEmailRequirements() { - Core::getConfig()->registration->needEmailForCommenting = true; - Core::getConfig()->registration->needEmailForUploading = true; + Core::getConfig()->comments->needEmailForCommenting = true; + Core::getConfig()->uploads->needEmailForUploading = true; $this->testRegularEmailRequirement(new AcceptUserRegistrationJob()); $this->testRegularEmailRequirement(new ActivateUserEmailJob()); @@ -69,10 +69,10 @@ class ApiEmailRequirementsTest extends AbstractFullApiTest { $this->testedJobs []= $job; - Core::getConfig()->registration->needEmailForCommenting = false; + Core::getConfig()->comments->needEmailForCommenting = false; $this->assert->areEqual(false, $job->isConfirmedEmailRequired()); - Core::getConfig()->registration->needEmailForCommenting = true; + Core::getConfig()->comments->needEmailForCommenting = true; $this->assert->areEqual(true, $job->isConfirmedEmailRequired()); } @@ -82,10 +82,10 @@ class ApiEmailRequirementsTest extends AbstractFullApiTest $this->testedJobs []= $job; - Core::getConfig()->registration->needEmailForUploading = false; + Core::getConfig()->uploads->needEmailForUploading = false; $this->assert->areEqual(false, $job->isConfirmedEmailRequired()); - Core::getConfig()->registration->needEmailForUploading = true; + Core::getConfig()->uploads->needEmailForUploading = true; $this->assert->areEqual(true, $job->isConfirmedEmailRequired()); } @@ -93,7 +93,7 @@ class ApiEmailRequirementsTest extends AbstractFullApiTest { $this->grantAccess('addComment'); $this->login($this->userMocker->mockSingle()); - Core::getConfig()->registration->needEmailForCommenting = true; + Core::getConfig()->comments->needEmailForCommenting = true; $this->assert->throws(function() { $post = $this->postMocker->mockSingle(); diff --git a/tests/Tests/ApiTests/ApiPrivilegeTest.php b/tests/Tests/ApiTests/ApiPrivilegeTest.php index 87b8f5c4..62097dfd 100644 --- a/tests/Tests/ApiTests/ApiPrivilegeTest.php +++ b/tests/Tests/ApiTests/ApiPrivilegeTest.php @@ -205,7 +205,7 @@ class ApiPrivilegeTest extends AbstractFullApiTest public function testPrivilegeEnforcing() { $post = $this->postMocker->mockSingle(); - Core::getConfig()->registration->needEmailForCommenting = false; + Core::getConfig()->comments->needEmailForCommenting = false; $this->assert->throws(function() use ($post) { @@ -221,7 +221,7 @@ class ApiPrivilegeTest extends AbstractFullApiTest public function testComplexPrivilegeEnforcing() { $post = $this->postMocker->mockSingle(); - Core::getConfig()->registration->needEmailForCommenting = false; + Core::getConfig()->comments->needEmailForCommenting = false; $this->grantAccess('editPost.own'); $this->grantAccess('editPostTags.own'); $this->revokeAccess('editPost.all'); diff --git a/tests/Tests/ControllerTests/ApiControllerTest.php b/tests/Tests/ControllerTests/ApiControllerTest.php index 508b150f..1c840a46 100644 --- a/tests/Tests/ControllerTests/ApiControllerTest.php +++ b/tests/Tests/ControllerTests/ApiControllerTest.php @@ -4,7 +4,7 @@ class ApiControllerTest extends AbstractTest public function testRunning() { Core::getConfig()->registration->needEmailForRegistering = false; - Core::getConfig()->registration->needEmailForUploading = false; + Core::getConfig()->uploads->needEmailForUploading = false; $user = $this->userMocker->mockSingle(); $this->grantAccess('addPost'); diff --git a/tests/Tests/JobTests/AddCommentJobTest.php b/tests/Tests/JobTests/AddCommentJobTest.php index 226ecd7a..23c8f1b3 100644 --- a/tests/Tests/JobTests/AddCommentJobTest.php +++ b/tests/Tests/JobTests/AddCommentJobTest.php @@ -109,7 +109,7 @@ class AddCommentJobTest extends AbstractTest protected function prepare() { - Core::getConfig()->registration->needEmailForCommenting = false; + Core::getConfig()->comments->needEmailForCommenting = false; $this->grantAccess('addComment'); $this->login($this->userMocker->mockSingle()); } diff --git a/tests/Tests/JobTests/AddPostJobTest.php b/tests/Tests/JobTests/AddPostJobTest.php index a1116af7..9e0a31de 100644 --- a/tests/Tests/JobTests/AddPostJobTest.php +++ b/tests/Tests/JobTests/AddPostJobTest.php @@ -180,6 +180,6 @@ class AddPostJobTest extends AbstractTest protected function prepare() { - Core::getConfig()->registration->needEmailForUploading = false; + Core::getConfig()->uploads->needEmailForUploading = false; } } diff --git a/tests/Tests/JobTests/PreviewCommentJobTest.php b/tests/Tests/JobTests/PreviewCommentJobTest.php index b38e600d..0b2ad9bf 100644 --- a/tests/Tests/JobTests/PreviewCommentJobTest.php +++ b/tests/Tests/JobTests/PreviewCommentJobTest.php @@ -106,7 +106,7 @@ class PreviewCommentJobTest extends AbstractTest protected function prepare() { - Core::getConfig()->registration->needEmailForCommenting = false; + Core::getConfig()->comments->needEmailForCommenting = false; $this->grantAccess('addComment'); $this->login($this->userMocker->mockSingle()); } diff --git a/tests/config.ini b/tests/config.ini index e456681a..eb9e94bc 100644 --- a/tests/config.ini +++ b/tests/config.ini @@ -10,7 +10,6 @@ salt = "salt..." [misc] featuredPostMaxDays=7 debugQueries=0 -logAnonymousUploads=1 [help] title=Help @@ -50,6 +49,9 @@ maxLength = 2000 commentsPerPage = 10 maxCommentsInList = 5 +[uploads] +logAnonymousUploads=1 + [registration] staffActivation = 0 passMinLength = 5