Skip to content

Commit

Permalink
Get correct path
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <[email protected]>
  • Loading branch information
rullzer committed Oct 29, 2019
1 parent 9c20c62 commit 377e144
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions apps/files_sharing/lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

namespace OCA\Files_Sharing\Notification;

use OCP\Files\IRootFolder;
use OCP\L10N\IFactory;
use OCP\Notification\AlreadyProcessedException;
use OCP\Notification\INotification;
Expand All @@ -39,10 +40,15 @@ class Notifier implements INotifier {
/** @var IManager */
private $shareManager;

/** @var IRootFolder */
private $rootFolder;

public function __construct(IFactory $l10nFactory,
IManager $shareManager) {
IManager $shareManager,
IRootFolder $rootFolder) {
$this->l10nFactory = $l10nFactory;
$this->shareManager = $shareManager;
$this->rootFolder = $rootFolder;
}

public function getID(): string {
Expand All @@ -69,6 +75,9 @@ public function prepare(INotification $notification, string $languageCode): INot
}

$node = $share->getNode();
$userFolder = $this->rootFolder->getUserFolder($notification->getUser());
$path = $userFolder->getRelativePath($node->getPath());

$notification
->setParsedSubject($l->t('Share will expire tomorrow'))
->setParsedMessage($l->t('One or more of your shares will expire tomorrow'))
Expand All @@ -79,7 +88,7 @@ public function prepare(INotification $notification, string $languageCode): INot
'type' => 'file',
'id' => $node->getId(),
'name' => $node->getName(),
'path' => $node->getPath(),
'path' => $path,
],
]
);
Expand Down

0 comments on commit 377e144

Please sign in to comment.