From 5885a75a96cde79003fc9c03c449a28bf8aabf9c Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Mon, 22 Apr 2024 15:19:59 -0700 Subject: [PATCH 1/2] feat: Add legal notice and privacy policy links to help page Signed-off-by: Christopher Ng --- apps/settings/lib/Controller/HelpController.php | 11 +++++++++++ apps/settings/templates/help.php | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/apps/settings/lib/Controller/HelpController.php b/apps/settings/lib/Controller/HelpController.php index 1a85830650204..ff6a55a449064 100644 --- a/apps/settings/lib/Controller/HelpController.php +++ b/apps/settings/lib/Controller/HelpController.php @@ -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; @@ -59,6 +60,9 @@ class HelpController extends Controller { /** @var IConfig */ private $config; + /** @var IAppConfig */ + private $appConfig; + public function __construct( string $appName, IRequest $request, @@ -68,6 +72,7 @@ public function __construct( IGroupManager $groupManager, IL10N $l10n, IConfig $config, + IAppConfig $appConfig, ) { parent::__construct($appName, $request); $this->navigationManager = $navigationManager; @@ -76,6 +81,7 @@ public function __construct( $this->groupManager = $groupManager; $this->l10n = $l10n; $this->config = $config; + $this->appConfig = $appConfig; } /** @@ -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, @@ -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\''); diff --git a/apps/settings/templates/help.php b/apps/settings/templates/help.php index 1b912d3d9044c..4d03faf00e0cf 100644 --- a/apps/settings/templates/help.php +++ b/apps/settings/templates/help.php @@ -73,6 +73,16 @@ t('Forum')); ?> ↗ + + + t('Legal notice')); ?> ↗ + + + + + t('Privacy policy')); ?> ↗ + + From 1dec7e6e73ff055ccb8db15dbbbcac23a43b9fa9 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Mon, 22 Apr 2024 15:19:59 -0700 Subject: [PATCH 2/2] feat: Update help entry name Signed-off-by: Christopher Ng --- apps/settings/templates/help.php | 2 +- lib/private/NavigationManager.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/settings/templates/help.php b/apps/settings/templates/help.php index 4d03faf00e0cf..68ea36bbde924 100644 --- a/apps/settings/templates/help.php +++ b/apps/settings/templates/help.php @@ -56,7 +56,7 @@