aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2024-11-08 08:57:22 +0100
committerskjnldsv <skjnldsv@protonmail.com>2024-11-08 14:20:58 +0100
commit4d9d617c840431568fc17540937b231b1bc2d698 (patch)
treef5ecef12122c2c7bbc6b0acb999ef068501413a0 /apps/files_sharing
parent2ec74f9dc1a395aa272da90ebaac973a489a5919 (diff)
downloadnextcloud-server-4d9d617c840431568fc17540937b231b1bc2d698.tar.gz
nextcloud-server-4d9d617c840431568fc17540937b231b1bc2d698.zip
feat(files_sharing): use share node or label as page titlefeat/sharing-title
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php4
-rw-r--r--apps/files_sharing/tests/Controller/ShareControllerTest.php3
2 files changed, 7 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php b/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php
index dad1f332458..0c76f0e1742 100644
--- a/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php
+++ b/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php
@@ -130,12 +130,16 @@ class DefaultPublicShareTemplateProvider implements IPublicShareTemplateProvider
'index',
);
$response->setContentSecurityPolicy($csp);
+
// If the share has a label, use it as the title
if ($share->getLabel() !== '') {
$response->setHeaderTitle($share->getLabel());
+ $response->setParams(['pageTitle' => $share->getLabel()]);
} else {
$response->setHeaderTitle($shareNode->getName());
+ $response->setParams(['pageTitle' => $shareNode->getName()]);
}
+
if ($ownerName !== '') {
$response->setHeaderDetails($this->l10n->t('shared by %s', [$ownerName]));
}
diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php
index 5d962dff4c0..bc8e5dede63 100644
--- a/apps/files_sharing/tests/Controller/ShareControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php
@@ -338,6 +338,7 @@ class ShareControllerTest extends \Test\TestCase {
$csp = new ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');
$expectedResponse = new PublicTemplateResponse('files', 'index');
+ $expectedResponse->setParams(['pageTitle' => $filename]);
$expectedResponse->setContentSecurityPolicy($csp);
$expectedResponse->setHeaderTitle($filename);
$expectedResponse->setHeaderDetails('shared by ownerDisplay');
@@ -477,6 +478,7 @@ class ShareControllerTest extends \Test\TestCase {
$csp = new ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');
$expectedResponse = new PublicTemplateResponse('files', 'index');
+ $expectedResponse->setParams(['pageTitle' => $filename]);
$expectedResponse->setContentSecurityPolicy($csp);
$expectedResponse->setHeaderTitle($filename);
$expectedResponse->setHeaderDetails('shared by ownerDisplay');
@@ -604,6 +606,7 @@ class ShareControllerTest extends \Test\TestCase {
$csp = new ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');
$expectedResponse = new PublicTemplateResponse('files', 'index');
+ $expectedResponse->setParams(['pageTitle' => $filename]);
$expectedResponse->setContentSecurityPolicy($csp);
$expectedResponse->setHeaderTitle($filename);
$expectedResponse->setHeaderDetails('');