diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index a5c158d2602da..2612e85d8d619 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -595,6 +595,18 @@ protected function wasEmailTestSuccessful(): bool { return true; } + protected function isPreviewMaxSetCorrectly(): bool { + if ($this->config->getSystemValueInt('preview_max_x', 4096) < 4096) { + return false; + } + + if ($this->config->getSystemValueInt('preview_max_y', 4096) < 4096) { + return false; + } + + return true; + } + protected function hasValidTransactionIsolationLevel(): bool { try { if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) { @@ -865,6 +877,7 @@ public function check() { 'isReadOnlyConfig' => $this->isReadOnlyConfig(), 'hasValidTransactionIsolationLevel' => $this->hasValidTransactionIsolationLevel(), 'wasEmailTestSuccessful' => $this->wasEmailTestSuccessful(), + 'isPreviewMaxSetCorrectly' => $this->isPreviewMaxSetCorrectly(), 'hasFileinfoInstalled' => $this->hasFileinfoInstalled(), 'hasWorkingFileLocking' => $this->hasWorkingFileLocking(), 'suggestedOverwriteCliURL' => $this->getSuggestedOverwriteCliURL(), diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index 81aa7af0b21c5..21d7d060acae9 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -183,6 +183,7 @@ protected function setUp(): void { ->setMethods([ 'isReadOnlyConfig', 'wasEmailTestSuccessful', + 'isPreviewMaxSetCorrectly', 'hasValidTransactionIsolationLevel', 'hasFileinfoInstalled', 'hasWorkingFileLocking', @@ -490,6 +491,10 @@ public function testCheck() { ->expects($this->once()) ->method('wasEmailTestSuccessful') ->willReturn(false); + $this->checkSetupController + ->expects($this->once()) + ->method('isPreviewMaxSetCorrectly') + ->willReturn(true); $this->checkSetupController ->expects($this->once()) ->method('hasValidTransactionIsolationLevel') @@ -601,6 +606,7 @@ public function testCheck() { 'isGetenvServerWorking' => true, 'isReadOnlyConfig' => false, 'wasEmailTestSuccessful' => false, + 'isPreviewMaxSetCorrectly' => true, 'hasValidTransactionIsolationLevel' => true, 'hasFileinfoInstalled' => true, 'hasWorkingFileLocking' => true, diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 67f8d70bd31ab..ae9bd7c51bcf6 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -203,6 +203,12 @@ type: OC.SetupChecks.MESSAGE_TYPE_INFO }); } + if (!data.isPreviewMaxSetCorrectly) { + messages.push({ + msg: t('core', 'Your maximum preview size settings are below 4K. Image previews may appear blurry to some users.'), + type: OC.SetupChecks.MESSAGE_TYPE_INFO + }); + } if (!data.hasValidTransactionIsolationLevel) { messages.push({ msg: t('core', 'Your database does not run with "READ COMMITTED" transaction isolation level. This can cause problems when multiple actions are executed in parallel.'), diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 6df1659d7d3f1..8add8078e4c0f 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -227,6 +227,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -288,6 +289,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -350,6 +352,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -409,6 +412,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -467,6 +471,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -525,6 +530,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: false, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -570,6 +576,65 @@ describe('OC.SetupChecks tests', function() { }); }); + it('should return an info when preview max is not configured correctly', function(done) { + var async = OC.SetupChecks.checkSetup(); + + suite.server.requests[0].respond( + 200, + { + 'Content-Type': 'application/json' + }, + JSON.stringify({ + hasFileinfoInstalled: true, + isGetenvServerWorking: true, + isReadOnlyConfig: false, + wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: false, + hasWorkingFileLocking: true, + hasValidTransactionIsolationLevel: true, + suggestedOverwriteCliURL: '', + isRandomnessSecure: true, + securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, + serverHasInternetConnectionProblems: false, + isMemcacheConfigured: true, + forwardedForHeadersWorking: true, + isCorrectMemcachedPHPModuleInstalled: true, + hasPassedCodeIntegrityCheck: true, + OpcacheSetupRecommendations: [], + isSettimelimitAvailable: true, + hasFreeTypeSupport: true, + missingIndexes: [], + missingPrimaryKeys: [], + missingColumns: [], + cronErrors: [], + cronInfo: { + diffInSeconds: 0 + }, + isMemoryLimitSufficient: true, + appDirsWithDifferentOwner: [], + isImagickEnabled: true, + areWebauthnExtensionsEnabled: true, + is64bit: true, + recommendedPHPModules: [], + pendingBigIntConversionColumns: [], + isMysqlUsedWithoutUTF8MB4: false, + isDefaultPhoneRegionSet: true, + isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, + reverseProxyGeneratedURL: 'https://server', + temporaryDirectoryWritable: true, + }) + ); + + async.done(function( data, s, x ){ + expect(data).toEqual([{ + msg: 'Your maximum preview size settings are below 4K. Image previews may appear blurry to some users.', + type: OC.SetupChecks.MESSAGE_TYPE_INFO + }]); + done(); + }); + }); + it('should return a warning if there are app directories with wrong permissions', function(done) { var async = OC.SetupChecks.checkSetup(); @@ -583,6 +648,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -643,6 +709,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -701,6 +768,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -759,6 +827,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -837,6 +906,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -896,6 +966,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -954,6 +1025,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1012,6 +1084,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1074,6 +1147,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1133,6 +1207,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1189,6 +1264,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1248,6 +1324,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1307,6 +1384,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1365,6 +1443,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1423,6 +1502,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1481,6 +1561,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '',