Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Dec 7, 2022
1 parent 8eb259f commit 73d8b4b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions lib/CheckQuota.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ public function check(string $userId): void {

$usage = $this->getRelativeQuotaUsage($userId);

if ($usage > $this->config->getAppValue('quota_warning', 'alert_percentage', 95)) {
if ($usage > $this->config->getAppValue('quota_warning', 'alert_percentage', '95')) {
if ($this->shouldIssueWarning($userId, 'alert')) {
$this->issueWarning($userId, $usage);
if ($this->config->getAppValue('quota_warning', 'alert_email', 'no') === 'yes') {
$this->sendEmail($userId, $usage);
}
}
$this->updateLastWarning($userId, 'alert');
} elseif ($usage > $this->config->getAppValue('quota_warning', 'warning_percentage', 90)) {
} elseif ($usage > $this->config->getAppValue('quota_warning', 'warning_percentage', '90')) {
if ($this->shouldIssueWarning($userId, 'warning')) {
$this->issueWarning($userId, $usage);
if ($this->config->getAppValue('quota_warning', 'warning_email', 'no') === 'yes') {
Expand All @@ -105,7 +105,7 @@ public function check(string $userId): void {
}
$this->updateLastWarning($userId, 'warning');
$this->removeLastWarning($userId, 'alert');
} elseif ($usage > $this->config->getAppValue('quota_warning', 'info_percentage', 85)) {
} elseif ($usage > $this->config->getAppValue('quota_warning', 'info_percentage', '85')) {
if ($this->shouldIssueWarning($userId, 'info')) {
$this->issueWarning($userId, $usage);
if ($this->config->getAppValue('quota_warning', 'info_email', 'no') === 'yes') {
Expand Down Expand Up @@ -190,7 +190,7 @@ protected function sendEmail(string $userId, float $percentage): void {

$link = $this->config->getAppValue('quota_warning', 'plan_management_url');

$help = $l->t('You are using more than %d%% of your storage quota. Try to free up some space by deleting old files you don\'t need anymore.', $percentage);
$help = $l->t('You are using more than %d%% of your storage quota. Try to free up some space by deleting old files you don\'t need anymore.', [$percentage]);
if ($link !== '') {
$emailTemplate->addBodyText(
htmlspecialchars($help . ' ' . $l->t('Or click the following button for options to change your data plan.')),
Expand Down Expand Up @@ -251,7 +251,7 @@ protected function shouldIssueWarning(string $userId, string $level): bool {
return true;
}

$days = (int) $this->config->getAppValue('quota_warning', 'repeat_warning', 7);
$days = (int) $this->config->getAppValue('quota_warning', 'repeat_warning', '7');

if ($days <= 0) {
return false;
Expand Down
6 changes: 3 additions & 3 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ public function prepare(INotification $notification, string $languageCode): INot
}

$usage = $this->checkQuota->getRelativeQuotaUsage($notification->getUser());
if ($usage < $this->config->getAppValue('quota_warning', 'info_percentage', 85)) {
if ($usage < $this->config->getAppValue('quota_warning', 'info_percentage', '85')) {
// User is not in danger zone anymore
throw new AlreadyProcessedException();
}

if ($usage > $this->config->getAppValue('quota_warning', 'alert_percentage', 95)) {
if ($usage > $this->config->getAppValue('quota_warning', 'alert_percentage', '95')) {
$imagePath = $this->url->imagePath(Application::APP_ID, 'app-alert.svg');
} elseif ($usage > $this->config->getAppValue('quota_warning', 'warning_percentage', 90)) {
} elseif ($usage > $this->config->getAppValue('quota_warning', 'warning_percentage', '90')) {
$imagePath = $this->url->imagePath(Application::APP_ID, 'app-warning.svg');
} else {
$imagePath = $this->url->imagePath(Application::APP_ID, 'app-dark.svg');
Expand Down
8 changes: 4 additions & 4 deletions lib/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ public function __construct(IConfig $config) {
public function getForm(): TemplateResponse {
$response = new TemplateResponse('quota_warning', 'settings');
$response->setParams([
'info_percentage' => $this->config->getAppValue('quota_warning', 'info_percentage', 85),
'info_percentage' => $this->config->getAppValue('quota_warning', 'info_percentage', '85'),
'info_email' => $this->config->getAppValue('quota_warning', 'info_email', 'no') === 'yes',
'warning_percentage' => $this->config->getAppValue('quota_warning', 'warning_percentage', 90),
'warning_percentage' => $this->config->getAppValue('quota_warning', 'warning_percentage', '90'),
'warning_email' => $this->config->getAppValue('quota_warning', 'warning_email', 'no') === 'yes',
'alert_percentage' => $this->config->getAppValue('quota_warning', 'alert_percentage', 95),
'alert_percentage' => $this->config->getAppValue('quota_warning', 'alert_percentage', '95'),
'alert_email' => $this->config->getAppValue('quota_warning', 'alert_email', 'no') === 'yes',
'plan_management_url' => $this->config->getAppValue('quota_warning', 'plan_management_url'),
'repeat_warning' => $this->config->getAppValue('quota_warning', 'repeat_warning', 7),
'repeat_warning' => $this->config->getAppValue('quota_warning', 'repeat_warning', '7'),
]);

return $response;
Expand Down

0 comments on commit 73d8b4b

Please sign in to comment.