Skip to content

Commit

Permalink
add a nice looking button as direct link to the sharre
Browse files Browse the repository at this point in the history
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
  • Loading branch information
schiessle committed Jul 13, 2018
1 parent 3b1a5de commit 7cbd4aa
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/private/Share20/DefaultShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -1318,14 +1318,6 @@ private function sendNote(array $recipients, IShare $share) {
$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');
Expand All @@ -1334,7 +1326,13 @@ private function sendNote(array $recipients, IShare $share) {
$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();
Expand Down

0 comments on commit 7cbd4aa

Please sign in to comment.