diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-11-18 14:37:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-18 14:37:16 +0100 |
commit | e5932c063d645a2eb8beece20ed456adef72a172 (patch) | |
tree | a55c2b694f7ae6a1a11736393a029d2d1f1a0347 /apps | |
parent | 6ff7db6ad4c79bf15c86d8b0d04a7a5badf91b6a (diff) | |
parent | 9e327a5890735d2a4dc3b7f88ab5fd571119c21d (diff) | |
download | nextcloud-server-e5932c063d645a2eb8beece20ed456adef72a172.tar.gz nextcloud-server-e5932c063d645a2eb8beece20ed456adef72a172.zip |
Merge pull request #48855 from nextcloud/fix/app-store-remove-force-enable
fix(apps-store): Remove apps from force-enabled state when uninstalled
Diffstat (limited to 'apps')
-rw-r--r-- | apps/settings/lib/Controller/AppSettingsController.php | 8 | ||||
-rw-r--r-- | apps/settings/tests/Controller/AppSettingsControllerTest.php | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index 7affb0d5069..4d34b7678d7 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -6,6 +6,7 @@ */ namespace OCA\Settings\Controller; +use OC\App\AppManager; use OC\App\AppStore\Bundles\BundleFetcher; use OC\App\AppStore\Fetcher\AppDiscoverFetcher; use OC\App\AppStore\Fetcher\AppFetcher; @@ -15,7 +16,6 @@ use OC\App\DependencyAnalyzer; use OC\App\Platform; use OC\Installer; use OCP\App\AppPathNotFoundException; -use OCP\App\IAppManager; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; @@ -62,7 +62,7 @@ class AppSettingsController extends Controller { private IL10N $l10n, private IConfig $config, private INavigationManager $navigationManager, - private IAppManager $appManager, + private AppManager $appManager, private CategoryFetcher $categoryFetcher, private AppFetcher $appFetcher, private IFactory $l10nFactory, @@ -592,6 +592,8 @@ class AppSettingsController extends Controller { $appId = $this->appManager->cleanAppId($appId); $result = $this->installer->removeApp($appId); if ($result !== false) { + // If this app was force enabled, remove the force-enabled-state + $this->appManager->removeOverwriteNextcloudRequirement($appId); $this->appManager->clearAppsCache(); return new JSONResponse(['data' => ['appid' => $appId]]); } @@ -631,7 +633,7 @@ class AppSettingsController extends Controller { public function force(string $appId): JSONResponse { $appId = $this->appManager->cleanAppId($appId); - $this->appManager->ignoreNextcloudRequirementForApp($appId); + $this->appManager->overwriteNextcloudRequirement($appId); return new JSONResponse(); } } diff --git a/apps/settings/tests/Controller/AppSettingsControllerTest.php b/apps/settings/tests/Controller/AppSettingsControllerTest.php index c219ee2fc9f..f72bd45a3d2 100644 --- a/apps/settings/tests/Controller/AppSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AppSettingsControllerTest.php @@ -6,13 +6,13 @@ */ namespace OCA\Settings\Tests\Controller; +use OC\App\AppManager; use OC\App\AppStore\Bundles\BundleFetcher; use OC\App\AppStore\Fetcher\AppDiscoverFetcher; use OC\App\AppStore\Fetcher\AppFetcher; use OC\App\AppStore\Fetcher\CategoryFetcher; use OC\Installer; use OCA\Settings\Controller\AppSettingsController; -use OCP\App\IAppManager; use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\TemplateResponse; @@ -47,8 +47,7 @@ class AppSettingsControllerTest extends TestCase { private $config; /** @var INavigationManager|MockObject */ private $navigationManager; - /** @var IAppManager|MockObject */ - private $appManager; + private AppManager&MockObject $appManager; /** @var CategoryFetcher|MockObject */ private $categoryFetcher; /** @var AppFetcher|MockObject */ @@ -83,7 +82,7 @@ class AppSettingsControllerTest extends TestCase { ->willReturnArgument(0); $this->config = $this->createMock(IConfig::class); $this->navigationManager = $this->createMock(INavigationManager::class); - $this->appManager = $this->createMock(IAppManager::class); + $this->appManager = $this->createMock(AppManager::class); $this->categoryFetcher = $this->createMock(CategoryFetcher::class); $this->appFetcher = $this->createMock(AppFetcher::class); $this->l10nFactory = $this->createMock(IFactory::class); |