Skip to content

Commit

Permalink
Merge pull request #22743 from nextcloud/backport/22589/stable18
Browse files Browse the repository at this point in the history
[stable18] Allow additional personal settings via normal registration
  • Loading branch information
nickvergessen authored Sep 29, 2020
2 parents c2262d7 + 963a03e commit 6f18e4c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/private/Settings/Manager.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 6f18e4c

Please sign in to comment.