Skip to content

Commit b72d270

Browse files
authored
Merge pull request #14753 from nextcloud/revert-13097-feature/11319/where-is-your-data
Revert "Where is your data?"
2 parents f8859e9 + 8b21c5e commit b72d270

File tree

22 files changed

+181
-766
lines changed

22 files changed

+181
-766
lines changed

apps/theming/appinfo/info.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323

2424
<settings>
2525
<admin>OCA\Theming\Settings\Admin</admin>
26+
<admin-section>OCA\Theming\Settings\Section</admin-section>
2627
</settings>
2728
</info>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
/**
3+
* @copyright Copyright (c) 2016 Arthur Schiwon <[email protected]>
4+
*
5+
* @author Arthur Schiwon <[email protected]>
6+
* @author Joas Schilling <[email protected]>
7+
*
8+
* @license GNU AGPL version 3 or any later version
9+
*
10+
* This program is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Affero General Public License as
12+
* published by the Free Software Foundation, either version 3 of the
13+
* License, or (at your option) any later version.
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Affero General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Affero General Public License
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
*
23+
*/
24+
25+
namespace OCA\Theming\Settings;
26+
27+
use OCP\IL10N;
28+
use OCP\IURLGenerator;
29+
use OCP\Settings\IIconSection;
30+
31+
class Section implements IIconSection {
32+
/** @var IL10N */
33+
private $l;
34+
/** @var IURLGenerator */
35+
private $url;
36+
37+
/**
38+
* @param IURLGenerator $url
39+
* @param IL10N $l
40+
*/
41+
public function __construct(IURLGenerator $url, IL10N $l) {
42+
$this->url = $url;
43+
$this->l = $l;
44+
}
45+
46+
/**
47+
* returns the ID of the section. It is supposed to be a lower case string,
48+
* e.g. 'ldap'
49+
*
50+
* @returns string
51+
*/
52+
public function getID() {
53+
return 'theming';
54+
}
55+
56+
/**
57+
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
58+
* integration'. Use the L10N service to translate it.
59+
*
60+
* @return string
61+
*/
62+
public function getName() {
63+
return $this->l->t('Theming');
64+
}
65+
66+
/**
67+
* @return int whether the form should be rather on the top or bottom of
68+
* the settings navigation. The sections are arranged in ascending order of
69+
* the priority values. It is required to return a value between 0 and 99.
70+
*
71+
* E.g.: 70
72+
*/
73+
public function getPriority() {
74+
return 30;
75+
}
76+
77+
/**
78+
* {@inheritdoc}
79+
*/
80+
public function getIcon() {
81+
return $this->url->imagePath('theming', 'app-dark.svg');
82+
}
83+
}

apps/theming/tests/ServicesTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
use OCA\Theming\Capabilities;
2727
use OCA\Theming\Controller\ThemingController;
2828
use OCA\Theming\Settings\Admin;
29+
use OCA\Theming\Settings\Section;
2930
use OCA\Theming\ThemingDefaults;
3031
use OCA\Theming\Util;
3132
use OCP\AppFramework\App;
3233
use OCP\Capabilities\ICapability;
3334
use OCP\IL10N;
35+
use OCP\Settings\ISection;
3436
use OCP\Settings\ISettings;
3537
use Test\TestCase;
3638

@@ -70,6 +72,8 @@ public function queryData() {
7072
// Settings
7173
[Admin::class],
7274
[Admin::class, ISettings::class],
75+
[Section::class],
76+
[Section::class, ISection::class],
7377
];
7478
}
7579

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
/**
3+
* @copyright Copyright (c) 2016 Lukas Reschke <[email protected]>
4+
*
5+
* @author Joas Schilling <[email protected]>
6+
* @author Lukas Reschke <[email protected]>
7+
*
8+
* @license GNU AGPL version 3 or any later version
9+
*
10+
* This program is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Affero General Public License as
12+
* published by the Free Software Foundation, either version 3 of the
13+
* License, or (at your option) any later version.
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Affero General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Affero General Public License
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
*
23+
*/
24+
25+
namespace OCA\Theming\Tests\Settings;
26+
27+
use OCA\Theming\Settings\Section;
28+
use OCP\IL10N;
29+
use OCP\IURLGenerator;
30+
use Test\TestCase;
31+
32+
class SectionTest extends TestCase {
33+
/** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
34+
private $url;
35+
/** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
36+
private $l;
37+
/** @var Section */
38+
private $section;
39+
40+
public function setUp() {
41+
parent::setUp();
42+
$this->url = $this->createMock(IURLGenerator::class);
43+
$this->l = $this->createMock(IL10N::class);
44+
45+
$this->section = new Section(
46+
$this->url,
47+
$this->l
48+
);
49+
}
50+
51+
public function testGetID() {
52+
$this->assertSame('theming', $this->section->getID());
53+
}
54+
55+
public function testGetName() {
56+
$this->l
57+
->expects($this->once())
58+
->method('t')
59+
->with('Theming')
60+
->willReturn('Theming');
61+
62+
$this->assertSame('Theming', $this->section->getName());
63+
}
64+
65+
public function testGetPriority() {
66+
$this->assertSame(30, $this->section->getPriority());
67+
}
68+
69+
public function testGetIcon() {
70+
$this->url->expects($this->once())
71+
->method('imagePath')
72+
->with('theming', 'app-dark.svg')
73+
->willReturn('icon');
74+
75+
$this->assertSame('icon', $this->section->getIcon());
76+
}
77+
}

core/css/styles.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ a {
6060
* {
6161
cursor: pointer;
6262
}
63+
}
6364

64-
&.external {
65-
margin: 0 3px;
66-
text-decoration: underline;
67-
}
65+
a.external {
66+
margin: 0 3px;
67+
text-decoration: underline;
6868
}
6969

7070
input {

lib/composer/composer/autoload_classmap.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,6 @@
10891089
'OC\\Settings\\Controller\\LogSettingsController' => $baseDir . '/settings/Controller/LogSettingsController.php',
10901090
'OC\\Settings\\Controller\\MailSettingsController' => $baseDir . '/settings/Controller/MailSettingsController.php',
10911091
'OC\\Settings\\Controller\\PersonalSettingsController' => $baseDir . '/settings/Controller/PersonalSettingsController.php',
1092-
'OC\\Settings\\Controller\\ServerInfoSettingsController' => $baseDir . '/settings/Controller/ServerInfoSettingsController.php',
10931092
'OC\\Settings\\Controller\\TwoFactorSettingsController' => $baseDir . '/settings/Controller/TwoFactorSettingsController.php',
10941093
'OC\\Settings\\Controller\\UsersController' => $baseDir . '/settings/Controller/UsersController.php',
10951094
'OC\\Settings\\Hooks' => $baseDir . '/settings/Hooks.php',
@@ -1101,7 +1100,6 @@
11011100
'OC\\Settings\\Personal\\Security' => $baseDir . '/lib/private/Settings/Personal/Security.php',
11021101
'OC\\Settings\\Personal\\ServerDevNotice' => $baseDir . '/lib/private/Settings/Personal/ServerDevNotice.php',
11031102
'OC\\Settings\\Section' => $baseDir . '/lib/private/Settings/Section.php',
1104-
'OC\\Settings\\Theming\\ServerInfo' => $baseDir . '/lib/private/Settings/Theming/ServerInfo.php',
11051103
'OC\\Setup' => $baseDir . '/lib/private/Setup.php',
11061104
'OC\\Setup\\AbstractDatabase' => $baseDir . '/lib/private/Setup/AbstractDatabase.php',
11071105
'OC\\Setup\\MySQL' => $baseDir . '/lib/private/Setup/MySQL.php',

lib/composer/composer/autoload_static.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
11191119
'OC\\Settings\\Controller\\LogSettingsController' => __DIR__ . '/../../..' . '/settings/Controller/LogSettingsController.php',
11201120
'OC\\Settings\\Controller\\MailSettingsController' => __DIR__ . '/../../..' . '/settings/Controller/MailSettingsController.php',
11211121
'OC\\Settings\\Controller\\PersonalSettingsController' => __DIR__ . '/../../..' . '/settings/Controller/PersonalSettingsController.php',
1122-
'OC\\Settings\\Controller\\ServerInfoSettingsController' => __DIR__ . '/../../..' . '/settings/Controller/ServerInfoSettingsController.php',
11231122
'OC\\Settings\\Controller\\TwoFactorSettingsController' => __DIR__ . '/../../..' . '/settings/Controller/TwoFactorSettingsController.php',
11241123
'OC\\Settings\\Controller\\UsersController' => __DIR__ . '/../../..' . '/settings/Controller/UsersController.php',
11251124
'OC\\Settings\\Hooks' => __DIR__ . '/../../..' . '/settings/Hooks.php',
@@ -1131,7 +1130,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
11311130
'OC\\Settings\\Personal\\Security' => __DIR__ . '/../../..' . '/lib/private/Settings/Personal/Security.php',
11321131
'OC\\Settings\\Personal\\ServerDevNotice' => __DIR__ . '/../../..' . '/lib/private/Settings/Personal/ServerDevNotice.php',
11331132
'OC\\Settings\\Section' => __DIR__ . '/../../..' . '/lib/private/Settings/Section.php',
1134-
'OC\\Settings\\Theming\\ServerInfo' => __DIR__ . '/../../..' . '/lib/private/Settings/Theming/ServerInfo.php',
11351133
'OC\\Setup' => __DIR__ . '/../../..' . '/lib/private/Setup.php',
11361134
'OC\\Setup\\AbstractDatabase' => __DIR__ . '/../../..' . '/lib/private/Setup/AbstractDatabase.php',
11371135
'OC\\Setup\\MySQL' => __DIR__ . '/../../..' . '/lib/private/Setup/MySQL.php',

lib/private/Settings/Manager.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ public function getAdminSections(): array {
192192
1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
193193
5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
194194
10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
195-
30 => [new Section('theming', $this->l->t('Theming'), 0, $this->url->imagePath('settings', 'theming-dark.svg'))],
196195
50 => [new Section('groupware', $this->l->t('Groupware'), 0, $this->url->imagePath('core', 'places/contacts.svg'))],
197196
98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
198197
];
@@ -238,10 +237,6 @@ private function getBuiltInAdminSettings($section): array {
238237
$form = $this->container->query(Admin\Security::class);
239238
$forms[$form->getPriority()] = [$form];
240239
}
241-
if ($section === 'theming') {
242-
$form = $this->container->query(Theming\ServerInfo::class);
243-
$forms[$form->getPriority()] = [$form];
244-
}
245240
if ($section === 'sharing') {
246241
/** @var ISettings $form */
247242
$form = $this->container->query(Admin\Sharing::class);

lib/private/Settings/Personal/PersonalInfo.php

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
namespace OC\Settings\Personal;
2727

2828
use OC\Accounts\AccountManager;
29-
use OC\Settings\Theming\ServerInfo;
3029
use OCA\FederatedFileSharing\AppInfo\Application;
3130
use OCP\App\IAppManager;
3231
use OCP\AppFramework\Http\TemplateResponse;
@@ -39,7 +38,6 @@
3938
use OCP\IUserManager;
4039
use OCP\L10N\IFactory;
4140
use OCP\Settings\ISettings;
42-
use OCP\Encryption\IManager as EncryptionManager;
4341

4442
class PersonalInfo implements ISettings {
4543

@@ -57,18 +55,14 @@ class PersonalInfo implements ISettings {
5755
private $l10nFactory;
5856
/** @var IL10N */
5957
private $l;
60-
/** @var EncryptionManager */
61-
private $encryptionManager;
6258

6359
/**
6460
* @param IConfig $config
6561
* @param IUserManager $userManager
6662
* @param IGroupManager $groupManager
6763
* @param AccountManager $accountManager
68-
* @param IAppManager $appManager
6964
* @param IFactory $l10nFactory
7065
* @param IL10N $l
71-
* @param EncryptionManager $encryptionManager
7266
*/
7367
public function __construct(
7468
IConfig $config,
@@ -77,8 +71,7 @@ public function __construct(
7771
AccountManager $accountManager,
7872
IAppManager $appManager,
7973
IFactory $l10nFactory,
80-
IL10N $l,
81-
EncryptionManager $encryptionManager
74+
IL10N $l
8275
) {
8376
$this->config = $config;
8477
$this->userManager = $userManager;
@@ -87,7 +80,6 @@ public function __construct(
8780
$this->appManager = $appManager;
8881
$this->l10nFactory = $l10nFactory;
8982
$this->l = $l;
90-
$this->encryptionManager = $encryptionManager;
9183
}
9284

9385
/**
@@ -143,38 +135,10 @@ public function getForm() {
143135
'twitterScope' => $userData[AccountManager::PROPERTY_TWITTER]['scope'],
144136
'twitterVerification' => $userData[AccountManager::PROPERTY_TWITTER]['verified'],
145137
'groups' => $this->getGroups($user),
146-
] + $this->getWhereIsYourDataParams() + $messageParameters + $languageParameters + $localeParameters;
138+
] + $messageParameters + $languageParameters + $localeParameters;
147139

148-
return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, '');
149-
}
150-
151-
/**
152-
* Returns the "where is your data" template params.
153-
*
154-
* @return array
155-
*/
156-
private function getWhereIsYourDataParams(): array {
157-
158-
$adminContactConfigId = $this->config->getSystemValue(ServerInfo::SETTING_PROVIDER_ADMIN_CONTACT);
159-
$adminContact = $this->userManager->get($adminContactConfigId);
160-
161-
$params = [
162-
'dataLocation' => $this->config->getSystemValue(ServerInfo::SETTING_LOCATION),
163-
'provider' => $this->config->getSystemValue(ServerInfo::SETTING_PROVIDER),
164-
'providerLink' => $this->config->getSystemValue(ServerInfo::SETTING_PROVIDER_WEBSITE),
165-
'providerPrivacyLink' => $this->config->getSystemValue(ServerInfo::SETTING_PROVIDER_PRIVACY_LINK),
166-
'encryptionEnabled' => $this->encryptionManager->isEnabled(),
167-
'adminName' => $adminContact !== null ? $adminContact->getDisplayName() : '',
168-
'adminMail' => $adminContact !== null ? $adminContact->getEMailAddress() : ''
169-
];
170-
171-
$params['show_where_is_your_data_section'] = empty($params['dataLocation']) === false
172-
|| empty($params['provider']) === false
173-
|| $params['encryptionEnabled'] === true
174-
|| empty($params['adminName']) === false;
175-
176-
return $params;
177140

141+
return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, '');
178142
}
179143

180144
/**
@@ -238,7 +202,7 @@ private function getLanguages(IUser $user) {
238202
$userLang = $languages['commonlanguages'][$userLangIndex];
239203
// search in the other languages
240204
if ($userLangIndex === false) {
241-
$userLangIndex = array_search($userConfLang, array_column($languages['languages'], 'code'));
205+
$userLangIndex = array_search($userConfLang, array_column($languages['languages'], 'code'));
242206
$userLang = $languages['languages'][$userLangIndex];
243207
}
244208
// if user language is not available but set somehow: show the actual code as name

0 commit comments

Comments
 (0)