diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index 59175be68843b..2d20d10ac058f 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -587,6 +587,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) { @@ -867,6 +879,7 @@ public function check() { 'isReadOnlyConfig' => $this->isReadOnlyConfig(), 'hasValidTransactionIsolationLevel' => $this->hasValidTransactionIsolationLevel(), 'wasEmailTestSuccessful' => $this->wasEmailTestSuccessful(), + 'isPreviewMaxSetCorrectly' => $this->isPreviewMaxSetCorrectly(), 'hasFileinfoInstalled' => $this->hasFileinfoInstalled(), 'hasWorkingFileLocking' => $this->hasWorkingFileLocking(), 'hasDBFileLocking' => $this->hasDBFileLocking(), diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index d129850f29e6f..bffad1a9685a4 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', @@ -491,6 +492,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') @@ -606,6 +611,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 4fb020e44a311..8459092e7f8b1 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 max preview size settings are lower than 4K. Image previews may appear blurry to people using 4K screens.'), + 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 43f42d2610e66..bbc362ceec0d7 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, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -289,6 +290,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -352,6 +354,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -412,6 +415,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -471,6 +475,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -530,6 +535,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: false, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -635,6 +641,66 @@ 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, + hasDBFileLocking: false, + 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 max preview size settings are lower than 4K. Image previews may appear blurry to people using 4K screens.', + type: OC.SetupChecks.MESSAGE_TYPE_INFO + }]); + done(); + }); + }); + it('should return an info if database file locking is used', function(done) { var async = OC.SetupChecks.checkSetup(); @@ -648,6 +714,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: true, hasValidTransactionIsolationLevel: true, @@ -707,6 +774,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -768,6 +836,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -827,6 +896,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -886,6 +956,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -965,6 +1036,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -1025,6 +1097,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -1084,6 +1157,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -1143,6 +1217,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -1206,6 +1281,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -1266,6 +1342,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -1323,6 +1400,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -1383,6 +1461,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -1443,6 +1522,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -1502,6 +1582,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -1561,6 +1642,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true, @@ -1620,6 +1702,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasDBFileLocking: false, hasValidTransactionIsolationLevel: true,