Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup updatenotification #33947

Merged
merged 1 commit into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions apps/settings/css/settings.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/settings/css/settings.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions apps/settings/css/settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -901,10 +901,6 @@ span.version {
}
}

#version.section {
border-bottom: none;
}

.section {
margin-bottom: 0;
/* section divider lines, none needed for last one */
Expand All @@ -927,7 +923,6 @@ span.version {
.followupsection {
display: block;
padding: 0 30px 30px 30px;
color: #555;
}

.app-image {
Expand Down
56 changes: 18 additions & 38 deletions apps/updatenotification/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use OCP\User\Backend\ICountUsersBackend;
use OCA\UpdateNotification\UpdateChecker;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\IConfig;
use OCP\IDateTimeFormatter;
use OCP\IGroupManager;
Expand All @@ -44,22 +45,15 @@
use Psr\Log\LoggerInterface;

class Admin implements ISettings {
/** @var IConfig */
private $config;
/** @var UpdateChecker */
private $updateChecker;
/** @var IGroupManager */
private $groupManager;
/** @var IDateTimeFormatter */
private $dateTimeFormatter;
/** @var IFactory */
private $l10nFactory;
/** @var IRegistry */
private $subscriptionRegistry;
/** @var IUserManager */
private $userManager;
/** @var LoggerInterface */
private $logger;
private IConfig $config;
private UpdateChecker $updateChecker;
private IGroupManager $groupManager;
private IDateTimeFormatter $dateTimeFormatter;
private IFactory $l10nFactory;
private IRegistry $subscriptionRegistry;
private IUserManager $userManager;
private LoggerInterface $logger;
private IInitialState $initialState;

public function __construct(
IConfig $config,
Expand All @@ -69,7 +63,8 @@ public function __construct(
IFactory $l10nFactory,
IRegistry $subscriptionRegistry,
IUserManager $userManager,
LoggerInterface $logger
LoggerInterface $logger,
IInitialState $initialState
) {
$this->config = $config;
$this->updateChecker = $updateChecker;
Expand All @@ -79,11 +74,9 @@ public function __construct(
$this->subscriptionRegistry = $subscriptionRegistry;
$this->userManager = $userManager;
$this->logger = $logger;
$this->initialState = $initialState;
Fixed Show fixed Hide fixed
}

/**
* @return TemplateResponse
*/
public function getForm(): TemplateResponse {
$lastUpdateCheckTimestamp = $this->config->getAppValue('core', 'lastupdatedat');
$lastUpdateCheck = $this->dateTimeFormatter->formatDateTime($lastUpdateCheckTimestamp);
Expand Down Expand Up @@ -131,12 +124,9 @@ public function getForm(): TemplateResponse {
'notifyGroups' => $this->getSelectedGroups($notifyGroups),
'hasValidSubscription' => $hasValidSubscription,
];
$this->initialState->provideInitialState('data', $params);
Fixed Show fixed Hide fixed

$params = [
'json' => json_encode($params),
];

return new TemplateResponse('updatenotification', 'admin', $params, '');
return new TemplateResponse('updatenotification', 'admin', [], '');
}

protected function filterChanges(array $changes): array {
Expand All @@ -162,8 +152,8 @@ protected function filterChanges(array $changes): array {
}

/**
* @param array $groupIds
* @return array
* @param list<string> $groupIds
* @return list<array{id: string, displayname: string}>
*/
protected function getSelectedGroups(array $groupIds): array {
$result = [];
Expand All @@ -174,26 +164,16 @@ protected function getSelectedGroups(array $groupIds): array {
continue;
}

$result[] = ['value' => $group->getGID(), 'label' => $group->getDisplayName()];
$result[] = ['id' => $group->getGID(), 'displayname' => $group->getDisplayName()];
}

return $result;
}

/**
* @return string the section ID, e.g. 'sharing'
*/
public function getSection(): string {
return 'overview';
}

/**
* @return int whether the form should be rather on the top or bottom of
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
*/
public function getPriority(): int {
return 11;
}
Expand Down
Loading