Browse Source
Send permalink in internal share notification emails
remotes/origin/pending_shares
Vincent Petry
10 years ago
No known key found for this signature in database
GPG Key ID: AF8F9EFC56562186
2 changed files with
5 additions and
24 deletions
-
lib/private/Share/MailNotifications.php
-
tests/lib/share/MailNotificationsTest.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( |
|
|
$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'); |
|
|
list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration, 'internal'); |
|
|
|
|
|
@ -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' => '/', |
|
|
|
|
|
'scrollto' => 'welcome.txt' |
|
|
|
|
|
|
|
|
'fileId' => 123, |
|
|
]) |
|
|
]) |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|