Skip to content

Commit

Permalink
feat(files_sharing): use label as title and file drop destination if …
Browse files Browse the repository at this point in the history
…available

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Jul 17, 2024
1 parent 4862873 commit 7c5b854
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function renderPage(IShare $share, string $token, string $path): Template

$shareTmpl['filename'] = $shareNode->getName();
$shareTmpl['directory_path'] = $share->getTarget();
$shareTmpl['label'] = $share->getLabel();
$shareTmpl['note'] = $share->getNote();
$shareTmpl['mimetype'] = $shareNode->getMimetype();
$shareTmpl['previewSupported'] = $this->previewManager->isMimeSupported($shareNode->getMimetype());
Expand Down Expand Up @@ -240,6 +241,11 @@ public function renderPage(IShare $share, string $token, string $path): Template
$response->setHeaderDetails($this->l10n->t('shared by %s', [$shareTmpl['shareOwner']]));
}

// If the share has a label, use it as the title
if ($shareTmpl['label'] !== '') {
$response->setHeaderTitle($shareTmpl['label']);
}

$isNoneFileDropFolder = $shareIsFolder === false || $share->getPermissions() !== Constants::PERMISSION_CREATE;

if ($isNoneFileDropFolder && !$share->getHideDownload()) {
Expand Down
5 changes: 4 additions & 1 deletion apps/files_sharing/templates/public.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ class="emptycontent <?php if (!empty($_['note'])) { ?>has-note<?php } ?>">
<div id="displayavatar"><div class="avatardiv"></div></div>
<h2><?php p($l->t('Upload files to %s', [$_['shareOwner']])) ?></h2>
<p><span class="icon-folder"></span> <?php p($_['filename']) ?></p>
<?php } else { ?>
<?php } else if ($_['label']) { ?>
<div id="displayavatar"><span class="icon-folder"></span></div>
<h2><?php p($l->t('Upload files to %s', [$_['label']])) ?></h2>
<?php } else{ ?>
<div id="displayavatar"><span class="icon-folder"></span></div>
<h2><?php p($l->t('Upload files to %s', [$_['filename']])) ?></h2>
<?php } ?>
Expand Down

0 comments on commit 7c5b854

Please sign in to comment.