Send permalink in internal share notification emails

This commit is contained in:
Vincent Petry 2016-05-06 14:41:31 +02:00
parent 112b703df0
commit caefe23bb6
No known key found for this signature in database
GPG Key ID: AF8F9EFC56562186
2 changed files with 5 additions and 24 deletions

View File

@ -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( $link = $this->urlGenerator->linkToRouteAbsolute(
'files.view.index', 'files.viewcontroller.showFile',
$args ['fileId' => $items[0]['item_source']]
); );
list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration, 'internal'); list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration, 'internal');

View File

@ -222,7 +222,7 @@ class MailNotificationsTest extends \Test\TestCase {
$mailNotifications->method('getItemSharedWithUser') $mailNotifications->method('getItemSharedWithUser')
->withAnyParameters() ->withAnyParameters()
->willReturn([ ->willReturn([
['file_target' => '/welcome.txt'] ['file_target' => '/welcome.txt', 'item_source' => 123],
]); ]);
$recipient = $this->getMockBuilder('\OCP\IUser') $recipient = $this->getMockBuilder('\OCP\IUser')
@ -239,10 +239,9 @@ class MailNotificationsTest extends \Test\TestCase {
$this->urlGenerator->expects($this->once()) $this->urlGenerator->expects($this->once())
->method('linkToRouteAbsolute') ->method('linkToRouteAbsolute')
->with( ->with(
$this->equalTo('files.view.index'), $this->equalTo('files.viewcontroller.showFile'),
$this->equalTo([ $this->equalTo([
'dir' => '/', 'fileId' => 123,
'scrollto' => 'welcome.txt'
]) ])
); );