Make the where is your data section optional

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
This commit is contained in:
Michael Weimann 2019-01-29 19:42:12 +01:00
parent b8d25a1247
commit 6c52821389
No known key found for this signature in database
GPG Key ID: 34F0524D4DA694A1
2 changed files with 30 additions and 7 deletions

View File

@ -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, '');
}
/**

View File

@ -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">