From 7b2ee7718a02f3e706362399c22b6067cd76280b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Wed, 14 Jun 2023 12:11:13 +0200 Subject: [PATCH 1/2] fix: app boot and user script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- js/users-management.js | 1 - lib/AppInfo/Application.php | 18 ++++++++++++------ lib/Controller/SettingsController.php | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/js/users-management.js b/js/users-management.js index a8ceaa8..1306658 100644 --- a/js/users-management.js +++ b/js/users-management.js @@ -1,5 +1,4 @@ $(document).ready(function() { - sendEmail = function(event) { var userId = event.target.closest('div[data-id]').dataset.id; var button = event.target.parentElement; diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 032f883..e12ddc5 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -30,21 +30,27 @@ use OCP\AppFramework\App; use OCP\IServerContainer; use OCP\Util; +use OCP\EventDispatcher\IEventDispatcher; class Application extends App { public const APP_ID = 'preferred_providers'; public function __construct() { parent::__construct(self::APP_ID); - } - public function register() { - $this->registerNotifier($this->getContainer()->getServer()); - $this->getContainer()->query(LoginHook::class)->register(); + $container = $this->getContainer(); + $server = $container->query(IServerContainer::class); + + $this->registerNotifier($server); + + /** @var LoginHook */ + $loginHook = $container->query(LoginHook::class); + $loginHook->register(); - $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); + /** @var IEventDispatcher */ + $eventDispatcher = $server->query(IEventDispatcher::class); $eventDispatcher->addListener('OC\Settings\Users::loadAdditionalScripts', - function () { + function() { Util::addScript(self::APP_ID, 'users-management'); } ); diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 63abeee..0fb2f26 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -152,7 +152,7 @@ public function resetToken(): DataResponse { * @return DataResponse * @throws OCSNotFoundException */ - public function setGroups(array $groups, string $for = 'all'): DataResponse { + public function setGroups(array $groups = [], string $for = 'all'): DataResponse { foreach ($groups as $groupId) { if (!$this->groupManager->groupExists($groupId)) { throw new OCSNotFoundException($groupId . ' does not exists'); From 35117682920fdb104cd1199e30abf05b752a34a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Wed, 14 Jun 2023 12:11:39 +0200 Subject: [PATCH 2/2] 1.13.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- appinfo/info.xml | 2 +- lib/AppInfo/Application.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index ecb5648..a88ea50 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -4,7 +4,7 @@ Preferred Providers Allow nextcloud to request user accounts - 1.13.0 + 1.13.1 agpl John Molakvoæ Preferred_Providers diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index e12ddc5..39cd40d 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -28,9 +28,9 @@ use OCA\Preferred_Providers\Hook\LoginHook; use OCA\Preferred_Providers\Notification\Notifier; use OCP\AppFramework\App; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IServerContainer; use OCP\Util; -use OCP\EventDispatcher\IEventDispatcher; class Application extends App { public const APP_ID = 'preferred_providers'; @@ -50,7 +50,7 @@ public function __construct() { /** @var IEventDispatcher */ $eventDispatcher = $server->query(IEventDispatcher::class); $eventDispatcher->addListener('OC\Settings\Users::loadAdditionalScripts', - function() { + function () { Util::addScript(self::APP_ID, 'users-management'); } );