add a nice looking button as direct link to the sharre

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Bjoern Schiessle 2018-07-12 19:32:35 +02:00 committed by John Molakvoæ (skjnldsv)
parent 1ce519ad38
commit 2250dbec21
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
1 changed files with 7 additions and 9 deletions

View File

@ -1318,14 +1318,6 @@ class DefaultShareProvider implements IShareProvider {
$initiatorEmailAddress = ($initiatorUser instanceof IUser) ? $initiatorUser->getEMailAddress() : null;
$plainHeading = $this->l->t('%1$s shared »%2$s« with you and want to add:', [$initiatorDisplayName, $filename]);
$htmlHeading = $this->l->t('%1$s shared »%2$s« with you and want to add:', [$initiatorDisplayName, $filename]);
$link = $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $share->getNode()->getId()]);
if($share->getNode()->getType() === \OCP\Files\FileInfo::TYPE_FILE) {
$plainLink = $this->l->t('Direct link to the file: %s', [$link]);
$htmlLink = $this->l->t('<a href="%s">Direct link to the file.</a>', [$link]);
} else {
$plainLink = $this->l->t('Direct link to the folder: %s', [$link]);
$htmlLink = $this->l->t('<a href="%s">Direct link to the folder.</a>', [$link]);
}
$message = $this->mailer->createMessage();
$emailTemplate = $this->mailer->createEMailTemplate('defaultShareProvider.sendNote');
@ -1334,7 +1326,13 @@ class DefaultShareProvider implements IShareProvider {
$emailTemplate->addHeader();
$emailTemplate->addHeading($htmlHeading, $plainHeading);
$emailTemplate->addBodyText(htmlspecialchars($note), $note);
$emailTemplate->addBodyText($htmlLink, $plainLink);
$link = $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $share->getNode()->getId()]);
$emailTemplate->addBodyButton(
$this->l->t('Open »%s«', [$filename]),
$link
);
// The "From" contains the sharers name
$instanceName = $this->defaults->getName();