Skip to content
Snippets Groups Projects
Commit 4bbefdf6 authored by Björn Schießle's avatar Björn Schießle
Browse files

add expiration date if it is already set

parent e7959f4f
No related branches found
No related tags found
No related merge requests found
......@@ -114,7 +114,11 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
if ($email !== '') {
$displayName = \OCP\User::getDisplayName($recipient);
$items = \OCP\Share::getItemSharedWithUser($itemType, $itemSource, $recipient);
$filename = $items[0]['file_target'];
$filename = trim($items[0]['file_target'], '/');
$expiration = null;
if (isset($items[0]['expiration'])) {
$expiration = $items[0]['expiration'];
}
if ($itemType === 'folder') {
$foldername = "/Shared/" . $filename;
......@@ -125,7 +129,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
}
$url = \OCP\Util::linkToAbsolute('files', 'index.php', array("dir" => $foldername));
$text = $defaults->getShareNotificationText(\OCP\User::getDisplayName(), $filename, $itemType, $url);
$text = $defaults->getShareNotificationText(\OCP\User::getDisplayName(), $filename, $itemType, $url, $expiration);
try {
OCP\Util::sendMail(
......
......@@ -65,12 +65,17 @@ class OC_Defaults {
* @param string $itemName name of the file/folder
* @param string $itemType typically "file" or "folder"
* @param string $link link directly to the file/folder in your ownCloud
* @param string $expiration expiration date
*/
public function getShareNotificationText($sender, $itemName, $itemType, $link) {
public function getShareNotificationText($sender, $itemName, $itemType, $link, $expiration=null) {
if ($this->themeExist('getShareNotificationText')) {
return $this->theme->getShareNotificationText($sender, $itemName, $itemType, $link);
return $this->theme->getShareNotificationText($sender, $itemName, $itemType, $link, $expiration);
} else {
return $this->l->t("%s shared a %s called %s with you. You can find the %s here: %s", array($sender, $itemType, $itemName, $itemType, $link));
if ($expiration) {
return $this->l->t("%s shared a %s called %s with you. The share will expire at %s. You can find the %s here: %s", array($sender, $itemType, $itemName, $expiration, $itemType, $link));
} else {
return $this->l->t("%s shared a %s called %s with you. You can find the %s here: %s", array($sender, $itemType, $itemName, $itemType, $link));
}
}
}
......
......@@ -48,9 +48,10 @@ class Defaults {
* @param string $itemName name of the file/folder
* @param string $itemType typically "file" or "folder"
* @param string $link link directly to the file/folder in your ownCloud
* @param string $expiration expiration date
*/
public function getShareNotificationText($sender, $itemName, $itemType, $link) {
return $this->defaults->getShareNotificationText($sender, $itemName, $itemType, $link);
public function getShareNotificationText($sender, $itemName, $itemType, $link, $expiration) {
return $this->defaults->getShareNotificationText($sender, $itemName, $itemType, $link, $expiration);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment