summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-05-06 14:41:31 +0200
committerVincent Petry <pvince81@owncloud.com>2016-05-06 16:46:59 +0200
commitcaefe23bb610308324d9436dd7c1e109118062eb (patch)
treeb4df46557029454d1db44f6ac56fa3989a065b37
parent112b703df0d695f2f54a844c36dbf852be437ea1 (diff)
downloadnextcloud-server-caefe23bb610308324d9436dd7c1e109118062eb.tar.gz
nextcloud-server-caefe23bb610308324d9436dd7c1e109118062eb.zip
Send permalink in internal share notification emails
-rw-r--r--lib/private/Share/MailNotifications.php22
-rw-r--r--tests/lib/share/MailNotificationsTest.php7
2 files changed, 5 insertions, 24 deletions
diff --git a/lib/private/Share/MailNotifications.php b/lib/private/Share/MailNotifications.php
index f71651e71fc..afecff0b97b 100644
--- a/lib/private/Share/MailNotifications.php
+++ b/lib/private/Share/MailNotifications.php
@@ -119,27 +119,9 @@ class MailNotifications {
}
}
- // Link to folder, or root folder if a file
-
- if ($itemType === 'folder') {
- $args = array(
- 'dir' => $filename,
- );
- } else if (strpos($filename, '/')) {
- $args = array(
- 'dir' => '/' . dirname($filename),
- 'scrollto' => basename($filename),
- );
- } else {
- $args = array(
- 'dir' => '/',
- 'scrollto' => $filename,
- );
- }
-
$link = $this->urlGenerator->linkToRouteAbsolute(
- 'files.view.index',
- $args
+ 'files.viewcontroller.showFile',
+ ['fileId' => $items[0]['item_source']]
);
list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration, 'internal');
diff --git a/tests/lib/share/MailNotificationsTest.php b/tests/lib/share/MailNotificationsTest.php
index 8c8ca78f39a..f160fed57ae 100644
--- a/tests/lib/share/MailNotificationsTest.php
+++ b/tests/lib/share/MailNotificationsTest.php
@@ -222,7 +222,7 @@ class MailNotificationsTest extends \Test\TestCase {
$mailNotifications->method('getItemSharedWithUser')
->withAnyParameters()
->willReturn([
- ['file_target' => '/welcome.txt']
+ ['file_target' => '/welcome.txt', 'item_source' => 123],
]);
$recipient = $this->getMockBuilder('\OCP\IUser')
@@ -239,10 +239,9 @@ class MailNotificationsTest extends \Test\TestCase {
$this->urlGenerator->expects($this->once())
->method('linkToRouteAbsolute')
->with(
- $this->equalTo('files.view.index'),
+ $this->equalTo('files.viewcontroller.showFile'),
$this->equalTo([
- 'dir' => '/',
- 'scrollto' => 'welcome.txt'
+ 'fileId' => 123,
])
);