Skip to content

Commit aa4e0bb

Browse files
authored
Merge pull request #44973 from nextcloud/feat/legal-privacy-links
feat: Add legal notice and privacy policy links to help page
2 parents 9872755 + 3082bdc commit aa4e0bb

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

apps/settings/lib/Controller/HelpController.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
use OCP\AppFramework\Http\Attribute\OpenAPI;
3535
use OCP\AppFramework\Http\ContentSecurityPolicy;
3636
use OCP\AppFramework\Http\TemplateResponse;
37+
use OCP\IAppConfig;
3738
use OCP\IConfig;
3839
use OCP\IGroupManager;
3940
use OCP\IL10N;
@@ -59,6 +60,9 @@ class HelpController extends Controller {
5960
/** @var IConfig */
6061
private $config;
6162

63+
/** @var IAppConfig */
64+
private $appConfig;
65+
6266
public function __construct(
6367
string $appName,
6468
IRequest $request,
@@ -68,6 +72,7 @@ public function __construct(
6872
IGroupManager $groupManager,
6973
IL10N $l10n,
7074
IConfig $config,
75+
IAppConfig $appConfig,
7176
) {
7277
parent::__construct($appName, $request);
7378
$this->navigationManager = $navigationManager;
@@ -76,6 +81,7 @@ public function __construct(
7681
$this->groupManager = $groupManager;
7782
$this->l10n = $l10n;
7883
$this->config = $config;
84+
$this->appConfig = $appConfig;
7985
}
8086

8187
/**
@@ -107,6 +113,9 @@ public function help(string $mode = 'user'): TemplateResponse {
107113
$urlAdminDocs = $this->urlGenerator->linkToDocs('admin');
108114
}
109115

116+
$legalNoticeUrl = $this->appConfig->getValueString('theming', 'imprintUrl');
117+
$privacyUrl = $this->appConfig->getValueString('theming', 'privacyUrl');
118+
110119
$response = new TemplateResponse('settings', 'help', [
111120
'admin' => $this->groupManager->isAdmin($this->userId),
112121
'url' => $documentationUrl,
@@ -115,6 +124,8 @@ public function help(string $mode = 'user'): TemplateResponse {
115124
'mode' => $mode,
116125
'pageTitle' => $pageTitle,
117126
'knowledgebaseEmbedded' => $knowledgebaseEmbedded,
127+
'legalNoticeUrl' => $legalNoticeUrl,
128+
'privacyUrl' => $privacyUrl,
118129
]);
119130
$policy = new ContentSecurityPolicy();
120131
$policy->addAllowedFrameDomain('\'self\'');

apps/settings/templates/help.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<div class="help-wrapper">
5757
<div class="help-content">
5858
<h2 class="help-content__heading">
59-
<?php p($l->t('Nextcloud help resources')); ?>
59+
<?php p($l->t('Nextcloud help & privacy resources')); ?>
6060
</h2>
6161
<div class="help-content__body">
6262
<a class="button" target="_blank" rel="noreferrer noopener"
@@ -73,6 +73,16 @@
7373
<a href="https://help.nextcloud.com" class="button" target="_blank" rel="noreferrer noopener">
7474
<?php p($l->t('Forum')); ?>
7575
</a>
76+
<?php if ($_['legalNoticeUrl']) { ?>
77+
<a href="<?php print_unescaped($_['legalNoticeUrl']); ?>" class="button" target="_blank" rel="noreferrer noopener">
78+
<?php p($l->t('Legal notice')); ?>
79+
</a>
80+
<?php } ?>
81+
<?php if ($_['privacyUrl']) { ?>
82+
<a href="<?php print_unescaped($_['privacyUrl']); ?>" class="button" target="_blank" rel="noreferrer noopener">
83+
<?php p($l->t('Privacy policy')); ?>
84+
</a>
85+
<?php } ?>
7686
</div>
7787
</div>
7888
</div>

lib/private/NavigationManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ private function init() {
232232
'id' => 'help',
233233
'order' => 99998,
234234
'href' => $this->urlGenerator->linkToRoute('settings.Help.help'),
235-
'name' => $l->t('Help'),
235+
'name' => $l->t('Help & privacy'),
236236
'icon' => $this->urlGenerator->imagePath('settings', 'help.svg'),
237237
]);
238238
}

0 commit comments

Comments
 (0)