Skip to content

Commit

Permalink
show warning on personal settings page
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos authored and nickvergessen committed Oct 22, 2021
1 parent cb3f3ac commit a90f100
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 16 additions & 1 deletion apps/settings/lib/Settings/Personal/PersonalInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
use OCP\IUserManager;
use OCP\L10N\IFactory;
use OC\Profile\ProfileManager;
use OCP\Notification\IManager;
use OCP\Settings\ISettings;

class PersonalInfo implements ISettings {
Expand Down Expand Up @@ -84,6 +85,9 @@ class PersonalInfo implements ISettings {
/** @var IInitialState */
private $initialStateService;

/** @var IManager */
private $manager;

public function __construct(
IConfig $config,
IUserManager $userManager,
Expand All @@ -93,7 +97,8 @@ public function __construct(
IAppManager $appManager,
IFactory $l10nFactory,
IL10N $l,
IInitialState $initialStateService
IInitialState $initialStateService,
IManager $manager
) {
$this->config = $config;
$this->userManager = $userManager;
Expand All @@ -104,6 +109,7 @@ public function __construct(
$this->l10nFactory = $l10nFactory;
$this->l = $l;
$this->initialStateService = $initialStateService;
$this->manager = $manager;
}

public function getForm(): TemplateResponse {
Expand Down Expand Up @@ -158,6 +164,7 @@ public function getForm(): TemplateResponse {
'twitterScope' => $account->getProperty(IAccountManager::PROPERTY_TWITTER)->getScope(),
'twitterVerification' => $account->getProperty(IAccountManager::PROPERTY_TWITTER)->getVerified(),
'groups' => $this->getGroups($user),
'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService()
] + $messageParameters + $languageParameters + $localeParameters;

$personalInfoParameters = [
Expand Down Expand Up @@ -188,6 +195,14 @@ public function getForm(): TemplateResponse {
return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, '');
}

/**
* Check if is fair use of free push service
* @return boolean
*/
private function isFairUseOfFreePushService(): bool {
return $this->manager->isFairUseOfFreePushService();
}

/**
* returns the primary biography in an
* associative array
Expand Down
3 changes: 3 additions & 0 deletions apps/settings/templates/settings/personal/personal.info.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
]);
?>

<?php if ($_['isFairUseOfFreePushService']) : ?>
<div class="warning"><?php p($l->t('This community release of Nextcloud is unsupported and instant notifications are unavailable.')); ?></div>
<?php endif; ?>
<div id="personal-settings" data-lookup-server-upload-enabled="<?php p($_['lookupServerUploadEnabled'] ? 'true' : 'false') ?>">
<h2 class="hidden-visually"><?php p($l->t('Personal info')); ?></h2>
<div id="personal-settings-avatar-container" class="personal-settings-container">
Expand Down

0 comments on commit a90f100

Please sign in to comment.