diff options
Diffstat (limited to 'apps/settings')
3 files changed, 38 insertions, 2 deletions
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index e18dfb6028b..99e731b594c 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -78,6 +78,7 @@ use OCP\IRequest; use OCP\ITempManager; use OCP\IURLGenerator; use OCP\Lock\ILockingProvider; +use OCP\Notification\IManager; use OCP\Security\ISecureRandom; use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -114,6 +115,8 @@ class CheckSetupController extends Controller { private $connection; /** @var ITempManager */ private $tempManager; + /** @var IManager */ + private $manager; public function __construct($AppName, IRequest $request, @@ -131,7 +134,8 @@ class CheckSetupController extends Controller { ISecureRandom $secureRandom, IniGetWrapper $iniGetWrapper, IDBConnection $connection, - ITempManager $tempManager) { + ITempManager $tempManager, + IManager $manager) { parent::__construct($AppName, $request); $this->config = $config; $this->clientService = $clientService; @@ -148,6 +152,15 @@ class CheckSetupController extends Controller { $this->iniGetWrapper = $iniGetWrapper; $this->connection = $connection; $this->tempManager = $tempManager; + $this->manager = $manager; + } + + /** + * Check if is fair use of free push service + * @return bool + */ + private function isFairUseOfFreePushService(): bool { + return $this->manager->isFairUseOfFreePushService(); } /** @@ -761,6 +774,7 @@ Raw output 'suggestedOverwriteCliURL' => $this->getSuggestedOverwriteCliURL(), 'cronInfo' => $this->getLastCronInfo(), 'cronErrors' => $this->getCronErrors(), + 'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(), 'serverHasInternetConnectionProblems' => $this->hasInternetConnectivityProblems(), 'isMemcacheConfigured' => $this->isMemcacheConfigured(), 'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'), diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index 928c18998df..72c443ed1b6 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -52,6 +52,7 @@ use OCP\IUser; use OCP\IUserManager; use OCP\L10N\IFactory; use OC\Profile\ProfileManager; +use OCP\Notification\IManager; use OCP\Settings\ISettings; class PersonalInfo implements ISettings { @@ -84,6 +85,9 @@ class PersonalInfo implements ISettings { /** @var IInitialState */ private $initialStateService; + /** @var IManager */ + private $manager; + public function __construct( IConfig $config, IUserManager $userManager, @@ -93,7 +97,8 @@ class PersonalInfo implements ISettings { IAppManager $appManager, IFactory $l10nFactory, IL10N $l, - IInitialState $initialStateService + IInitialState $initialStateService, + IManager $manager ) { $this->config = $config; $this->userManager = $userManager; @@ -104,6 +109,7 @@ class PersonalInfo implements ISettings { $this->l10nFactory = $l10nFactory; $this->l = $l; $this->initialStateService = $initialStateService; + $this->manager = $manager; } public function getForm(): TemplateResponse { @@ -160,6 +166,7 @@ class PersonalInfo implements ISettings { '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 = [ @@ -191,6 +198,14 @@ class PersonalInfo implements ISettings { } /** + * 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 */ diff --git a/apps/settings/templates/settings/personal/personal.info.php b/apps/settings/templates/settings/personal/personal.info.php index d258f616229..4cd0e4e34d6 100644 --- a/apps/settings/templates/settings/personal/personal.info.php +++ b/apps/settings/templates/settings/personal/personal.info.php @@ -35,6 +35,13 @@ script('settings', [ 'vue-settings-personal-info', ]); ?> +<?php if (!$_['isFairUseOfFreePushService']) : ?> + <div class="section"> + <div class="warning"> + <?php p($l->t('This community release of Nextcloud is unsupported and instant notifications are unavailable.')); ?> + </div> + </div> +<?php endif; ?> <div id="personal-settings" data-federation-enabled="<?php p($_['federationEnabled'] ? 'true' : 'false') ?>" data-lookup-server-upload-enabled="<?php p($_['lookupServerUploadEnabled'] ? 'true' : 'false') ?>"> |