summaryrefslogtreecommitdiffstats
path: root/apps/updatenotification/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-01-31 10:54:22 +0100
committerJoas Schilling <coding@schilljs.com>2018-02-22 10:17:42 +0100
commit59c007bedd7d3af871738fcebaa108d35117682b (patch)
tree16e01e6f625eef5d1fee382b6a3bcd42ee4a5dd0 /apps/updatenotification/lib
parent308c7db3339a1edbcccddb0ba25356d980ce88e9 (diff)
downloadnextcloud-server-59c007bedd7d3af871738fcebaa108d35117682b.tar.gz
nextcloud-server-59c007bedd7d3af871738fcebaa108d35117682b.zip
Use VueSelect instead of select2
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/updatenotification/lib')
-rw-r--r--apps/updatenotification/lib/Settings/Admin.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/apps/updatenotification/lib/Settings/Admin.php b/apps/updatenotification/lib/Settings/Admin.php
index 55cab099940..258cba35e80 100644
--- a/apps/updatenotification/lib/Settings/Admin.php
+++ b/apps/updatenotification/lib/Settings/Admin.php
@@ -30,6 +30,7 @@ use OCA\UpdateNotification\UpdateChecker;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IDateTimeFormatter;
+use OCP\IGroupManager;
use OCP\Settings\ISettings;
use OCP\Util;
@@ -38,19 +39,24 @@ class Admin implements ISettings {
private $config;
/** @var UpdateChecker */
private $updateChecker;
+ /** @var IGroupManager */
+ private $groupManager;
/** @var IDateTimeFormatter */
private $dateTimeFormatter;
/**
* @param IConfig $config
* @param UpdateChecker $updateChecker
+ * @param IGroupManager $groupManager
* @param IDateTimeFormatter $dateTimeFormatter
*/
public function __construct(IConfig $config,
UpdateChecker $updateChecker,
+ IGroupManager $groupManager,
IDateTimeFormatter $dateTimeFormatter) {
$this->config = $config;
$this->updateChecker = $updateChecker;
+ $this->groupManager = $groupManager;
$this->dateTimeFormatter = $dateTimeFormatter;
}
@@ -90,7 +96,7 @@ class Admin implements ISettings {
'updaterEnabled' => empty($updateState['updaterEnabled']) ? false : $updateState['updaterEnabled'],
'isDefaultUpdateServerURL' => $updateServerURL === $defaultUpdateServerURL,
'updateServerURL' => $updateServerURL,
- 'notifyGroups' => implode('|', $notifyGroups),
+ 'notifyGroups' => $this->getSelectedGroups($notifyGroups),
];
$params = [
@@ -101,6 +107,25 @@ class Admin implements ISettings {
}
/**
+ * @param array $groupIds
+ * @return array
+ */
+ protected function getSelectedGroups(array $groupIds): array {
+ $result = [];
+ foreach ($groupIds as $groupId) {
+ $group = $this->groupManager->get($groupId);
+
+ if ($group === null) {
+ continue;
+ }
+
+ $result[] = ['value' => $group->getGID(), 'label' => $group->getDisplayName()];
+ }
+
+ return $result;
+ }
+
+ /**
* @return string the section ID, e.g. 'sharing'
*/
public function getSection(): string {