Skip to content

Commit

Permalink
Merge pull request #44973 from nextcloud/feat/legal-privacy-links
Browse files Browse the repository at this point in the history
feat: Add legal notice and privacy policy links to help page
  • Loading branch information
Pytal authored Apr 23, 2024
2 parents 9872755 + 3082bdc commit aa4e0bb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
11 changes: 11 additions & 0 deletions apps/settings/lib/Controller/HelpController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use OCP\AppFramework\Http\Attribute\OpenAPI;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IAppConfig;
use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IL10N;
Expand All @@ -59,6 +60,9 @@ class HelpController extends Controller {
/** @var IConfig */
private $config;

/** @var IAppConfig */
private $appConfig;

public function __construct(
string $appName,
IRequest $request,
Expand All @@ -68,6 +72,7 @@ public function __construct(
IGroupManager $groupManager,
IL10N $l10n,
IConfig $config,
IAppConfig $appConfig,
) {
parent::__construct($appName, $request);
$this->navigationManager = $navigationManager;
Expand All @@ -76,6 +81,7 @@ public function __construct(
$this->groupManager = $groupManager;
$this->l10n = $l10n;
$this->config = $config;
$this->appConfig = $appConfig;
}

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

$legalNoticeUrl = $this->appConfig->getValueString('theming', 'imprintUrl');
$privacyUrl = $this->appConfig->getValueString('theming', 'privacyUrl');

$response = new TemplateResponse('settings', 'help', [
'admin' => $this->groupManager->isAdmin($this->userId),
'url' => $documentationUrl,
Expand All @@ -115,6 +124,8 @@ public function help(string $mode = 'user'): TemplateResponse {
'mode' => $mode,
'pageTitle' => $pageTitle,
'knowledgebaseEmbedded' => $knowledgebaseEmbedded,
'legalNoticeUrl' => $legalNoticeUrl,
'privacyUrl' => $privacyUrl,
]);
$policy = new ContentSecurityPolicy();
$policy->addAllowedFrameDomain('\'self\'');
Expand Down
12 changes: 11 additions & 1 deletion apps/settings/templates/help.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<div class="help-wrapper">
<div class="help-content">
<h2 class="help-content__heading">
<?php p($l->t('Nextcloud help resources')); ?>
<?php p($l->t('Nextcloud help & privacy resources')); ?>
</h2>
<div class="help-content__body">
<a class="button" target="_blank" rel="noreferrer noopener"
Expand All @@ -73,6 +73,16 @@
<a href="https://help.nextcloud.com" class="button" target="_blank" rel="noreferrer noopener">
<?php p($l->t('Forum')); ?>
</a>
<?php if ($_['legalNoticeUrl']) { ?>
<a href="<?php print_unescaped($_['legalNoticeUrl']); ?>" class="button" target="_blank" rel="noreferrer noopener">
<?php p($l->t('Legal notice')); ?>
</a>
<?php } ?>
<?php if ($_['privacyUrl']) { ?>
<a href="<?php print_unescaped($_['privacyUrl']); ?>" class="button" target="_blank" rel="noreferrer noopener">
<?php p($l->t('Privacy policy')); ?>
</a>
<?php } ?>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/private/NavigationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private function init() {
'id' => 'help',
'order' => 99998,
'href' => $this->urlGenerator->linkToRoute('settings.Help.help'),
'name' => $l->t('Help'),
'name' => $l->t('Help & privacy'),
'icon' => $this->urlGenerator->imagePath('settings', 'help.svg'),
]);
}
Expand Down

0 comments on commit aa4e0bb

Please sign in to comment.