diff --git a/resources/views/users/preferences/notifications.blade.php b/resources/views/users/preferences/notifications.blade.php index ae89c087e..9817aac4d 100644 --- a/resources/views/users/preferences/notifications.blade.php +++ b/resources/views/users/preferences/notifications.blade.php @@ -20,20 +20,22 @@ 'label' => trans('preferences.notifications_opt_own_page_changes'), ]) -
- @include('form.toggle-switch', [ - 'name' => 'preferences[own-page-comments]', - 'value' => $preferences->notifyOnOwnPageComments(), - 'label' => trans('preferences.notifications_opt_own_page_comments'), - ]) -
-
- @include('form.toggle-switch', [ - 'name' => 'preferences[comment-replies]', - 'value' => $preferences->notifyOnCommentReplies(), - 'label' => trans('preferences.notifications_opt_comment_replies'), - ]) -
+ @if (!setting('app-disable-comments')) +
+ @include('form.toggle-switch', [ + 'name' => 'preferences[own-page-comments]', + 'value' => $preferences->notifyOnOwnPageComments(), + 'label' => trans('preferences.notifications_opt_own_page_comments'), + ]) +
+
+ @include('form.toggle-switch', [ + 'name' => 'preferences[comment-replies]', + 'value' => $preferences->notifyOnCommentReplies(), + 'label' => trans('preferences.notifications_opt_comment_replies'), + ]) +
+ @endif
diff --git a/tests/User/UserPreferencesTest.php b/tests/User/UserPreferencesTest.php index f5dae3e76..4a6cba7b3 100644 --- a/tests/User/UserPreferencesTest.php +++ b/tests/User/UserPreferencesTest.php @@ -156,6 +156,19 @@ class UserPreferencesTest extends TestCase $this->assertPermissionError($resp); } + public function test_notification_comment_options_only_exist_if_comments_active() + { + $resp = $this->asEditor()->get('/preferences/notifications'); + $resp->assertSee('Notify upon comments'); + $resp->assertSee('Notify upon replies'); + + setting()->put('app-disable-comments', true); + + $resp = $this->get('/preferences/notifications'); + $resp->assertDontSee('Notify upon comments'); + $resp->assertDontSee('Notify upon replies'); + } + public function test_update_sort_preference() { $editor = $this->users->editor();