Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 0 additions & 83 deletions apps/theming/lib/Settings/Section.php

This file was deleted.

4 changes: 0 additions & 4 deletions apps/theming/tests/ServicesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@
use OCA\Theming\Capabilities;
use OCA\Theming\Controller\ThemingController;
use OCA\Theming\Settings\Admin;
use OCA\Theming\Settings\Section;
use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
use OCP\AppFramework\App;
use OCP\Capabilities\ICapability;
use OCP\IL10N;
use OCP\Settings\ISection;
use OCP\Settings\ISettings;
use Test\TestCase;

Expand Down Expand Up @@ -72,8 +70,6 @@ public function queryData() {
// Settings
[Admin::class],
[Admin::class, ISettings::class],
[Section::class],
[Section::class, ISection::class],
];
}

Expand Down
77 changes: 0 additions & 77 deletions apps/theming/tests/Settings/SectionTest.php

This file was deleted.

8 changes: 4 additions & 4 deletions core/css/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ a {
* {
cursor: pointer;
}
}

a.external {
margin: 0 3px;
text-decoration: underline;
&.external {
margin: 0 3px;
text-decoration: underline;
}
}

input {
Expand Down
5 changes: 5 additions & 0 deletions lib/private/Settings/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public function getAdminSections(): array {
1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
30 => [new Section('theming', $this->l->t('Theming'), 0, $this->url->imagePath('settings', 'theming-dark.svg'))],
50 => [new Section('groupware', $this->l->t('Groupware'), 0, $this->url->imagePath('core', 'places/contacts.svg'))],
98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
];
Expand Down Expand Up @@ -237,6 +238,10 @@ private function getBuiltInAdminSettings($section): array {
$form = $this->container->query(Admin\Security::class);
$forms[$form->getPriority()] = [$form];
}
if ($section === 'theming') {
$form = $this->container->query(Theming\ServerInfo::class);
$forms[$form->getPriority()] = [$form];
}
if ($section === 'sharing') {
/** @var ISettings $form */
$form = $this->container->query(Admin\Sharing::class);
Expand Down
44 changes: 40 additions & 4 deletions lib/private/Settings/Personal/PersonalInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
namespace OC\Settings\Personal;

use OC\Accounts\AccountManager;
use OC\Settings\Theming\ServerInfo;
use OCA\FederatedFileSharing\AppInfo\Application;
use OCP\App\IAppManager;
use OCP\AppFramework\Http\TemplateResponse;
Expand All @@ -38,6 +39,7 @@
use OCP\IUserManager;
use OCP\L10N\IFactory;
use OCP\Settings\ISettings;
use OCP\Encryption\IManager as EncryptionManager;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IEncryptionManager would be more clear here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do this later as well together with the email check.


class PersonalInfo implements ISettings {

Expand All @@ -55,14 +57,18 @@ class PersonalInfo implements ISettings {
private $l10nFactory;
/** @var IL10N */
private $l;
/** @var EncryptionManager */
private $encryptionManager;

/**
* @param IConfig $config
* @param IUserManager $userManager
* @param IGroupManager $groupManager
* @param AccountManager $accountManager
* @param IAppManager $appManager
* @param IFactory $l10nFactory
* @param IL10N $l
* @param EncryptionManager $encryptionManager
*/
public function __construct(
IConfig $config,
Expand All @@ -71,7 +77,8 @@ public function __construct(
AccountManager $accountManager,
IAppManager $appManager,
IFactory $l10nFactory,
IL10N $l
IL10N $l,
EncryptionManager $encryptionManager
) {
$this->config = $config;
$this->userManager = $userManager;
Expand All @@ -80,6 +87,7 @@ public function __construct(
$this->appManager = $appManager;
$this->l10nFactory = $l10nFactory;
$this->l = $l;
$this->encryptionManager = $encryptionManager;
}

/**
Expand Down Expand Up @@ -135,12 +143,40 @@ public function getForm() {
'twitterScope' => $userData[AccountManager::PROPERTY_TWITTER]['scope'],
'twitterVerification' => $userData[AccountManager::PROPERTY_TWITTER]['verified'],
'groups' => $this->getGroups($user),
] + $messageParameters + $languageParameters + $localeParameters;

] + $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(): array {

$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() : ''
];

$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 string the section ID, e.g. 'sharing'
* @since 9.1
Expand Down Expand Up @@ -202,7 +238,7 @@ private function getLanguages(IUser $user) {
$userLang = $languages['commonlanguages'][$userLangIndex];
// search in the other languages
if ($userLangIndex === false) {
$userLangIndex = array_search($userConfLang, array_column($languages['languages'], 'code'));
$userLangIndex = array_search($userConfLang, array_column($languages['languages'], 'code'));
$userLang = $languages['languages'][$userLangIndex];
}
// if user language is not available but set somehow: show the actual code as name
Expand Down
Loading