Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable18] Allow additional personal settings via normal registration #22743

Merged
merged 2 commits into from Sep 29, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/private/Settings/Manager.php
Expand Up @@ -357,7 +357,8 @@ public function getPersonalSections(): array {
];

$legacyForms = \OC_App::getForms('personal');
if (!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
if ((!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms))
|| count($this->getPersonalSettings('additional')) > 1) {
$sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
}

Expand Down
12 changes: 12 additions & 0 deletions tests/lib/Settings/ManagerTest.php
Expand Up @@ -116,6 +116,10 @@ public function testGetPersonalSections() {

$this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class);

$this->container->method('query')
->with(\OCA\Settings\Personal\Additional::class)
->willReturn($this->createMock(\OCA\Settings\Personal\Additional::class));

$this->url->expects($this->exactly(3))
->method('imagePath')
->willReturnMap([
Expand Down Expand Up @@ -183,6 +187,10 @@ public function testGetPersonalSectionsEmptySection() {
['core', 'clients/phone.svg', '3'],
]);

$this->container->method('query')
->with(\OCA\Settings\Personal\Additional::class)
->willReturn($this->createMock(\OCA\Settings\Personal\Additional::class));

$this->assertArraySubset([
0 => [new Section('personal-info', 'Personal info', 0, '1')],
5 => [new Section('security', 'Security', 0, '2')],
Expand Down Expand Up @@ -290,6 +298,10 @@ public function testSameSectionAsPersonalAndAdmin() {
['settings', 'help.svg', '4'],
]);

$this->container->method('query')
->with(\OCA\Settings\Personal\Additional::class)
->willReturn($this->createMock(\OCA\Settings\Personal\Additional::class));

$this->assertEquals([
0 => [new Section('personal-info', 'Personal info', 0, '1')],
5 => [new Section('security', 'Security', 0, '2')],
Expand Down