diff options
author | Michael Weimann <mail@michael-weimann.eu> | 2019-01-29 19:42:12 +0100 |
---|---|---|
committer | Michael Weimann <mail@michael-weimann.eu> | 2019-01-29 19:42:12 +0100 |
commit | 6c5282138979a7d56feeb5d38462761f1102f1d1 (patch) | |
tree | 625a7eb8fabadef393a09582e9530575d35b4d37 | |
parent | b8d25a1247c7b602976cf3bca2dfb7a2aac5bb81 (diff) | |
download | nextcloud-server-6c5282138979a7d56feeb5d38462761f1102f1d1.tar.gz nextcloud-server-6c5282138979a7d56feeb5d38462761f1102f1d1.zip |
Make the where is your data section optional
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
-rw-r--r-- | lib/private/Settings/Personal/PersonalInfo.php | 31 | ||||
-rw-r--r-- | settings/templates/settings/personal/personal.info.php | 6 |
2 files changed, 30 insertions, 7 deletions
diff --git a/lib/private/Settings/Personal/PersonalInfo.php b/lib/private/Settings/Personal/PersonalInfo.php index 306e5271d8d..c018ea80ded 100644 --- a/lib/private/Settings/Personal/PersonalInfo.php +++ b/lib/private/Settings/Personal/PersonalInfo.php @@ -116,9 +116,6 @@ class PersonalInfo implements ISettings { $localeParameters = $this->getLocales($user); $messageParameters = $this->getMessageParameters($userData); - $adminContactConfigId = $this->config->getSystemValue(ServerInfo::SETTING_PROVIDER_ADMIN_CONTACT); - $adminContact = $this->userManager->get($adminContactConfigId); - $parameters = [ 'total_space' => $totalSpace, 'usage' => \OC_Helper::humanFileSize($storageInfo['used']), @@ -144,16 +141,38 @@ class PersonalInfo implements ISettings { 'twitterScope' => $userData[AccountManager::PROPERTY_TWITTER]['scope'], 'twitterVerification' => $userData[AccountManager::PROPERTY_TWITTER]['verified'], 'groups' => $this->getGroups($user), + ] + $this->getWhereIsYourDataParams() + $messageParameters + $languageParameters + $localeParameters; + + return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, ''); + } + + /** + * Returns the "where is your data" template params. + * + * @return array + */ + private function getWhereIsYourDataParams() { + + $adminContactConfigId = $this->config->getSystemValue(ServerInfo::SETTING_PROVIDER_ADMIN_CONTACT); + $adminContact = $this->userManager->get($adminContactConfigId); + + $params = [ 'dataLocation' => $this->config->getSystemValue(ServerInfo::SETTING_LOCATION), 'provider' => $this->config->getSystemValue(ServerInfo::SETTING_PROVIDER), 'providerLink' => $this->config->getSystemValue(ServerInfo::SETTING_PROVIDER_WEBSITE), 'providerPrivacyLink' => $this->config->getSystemValue(ServerInfo::SETTING_PROVIDER_PRIVACY_LINK), 'encryptionEnabled' => $this->encryptionManager->isEnabled(), 'adminName' => $adminContact !== null ? $adminContact->getDisplayName() : '', - 'adminMail' => $adminContact !== null ? $adminContact->getEMailAddress() : '', - ] + $messageParameters + $languageParameters + $localeParameters; + 'adminMail' => $adminContact !== null ? $adminContact->getEMailAddress() : '' + ]; + + $params['show_where_is_your_data_section'] = empty($params['dataLocation']) === false + || empty($params['provider']) === false + || $params['encryptionEnabled'] === true + || empty($params['adminName']) === false; + + return $params; - return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, ''); } /** diff --git a/settings/templates/settings/personal/personal.info.php b/settings/templates/settings/personal/personal.info.php index 5743777b4b9..a6e3eaf345b 100644 --- a/settings/templates/settings/personal/personal.info.php +++ b/settings/templates/settings/personal/personal.info.php @@ -95,7 +95,11 @@ script('settings', [ <progress value="<?php p($_['usage_relative']); ?>" max="100"<?php if($_['usage_relative'] > 80): ?> class="warn" <?php endif; ?>></progress> </div> </div> - <?php include __DIR__ . '/partials/where-is-your-data.php' ?> + <?php + if ($_['show_where_is_your_data_section']) { + include __DIR__ . '/partials/where-is-your-data.php'; + } + ?> </div> <div class="personal-settings-container"> |