add expiration date if it is already set
This commit is contained in:
parent
e7959f4fd2
commit
4bbefdf608
|
@ -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,14 +65,19 @@ 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 {
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getBaseUrl() {
|
||||
if ($this->themeExist('getBaseUrl')) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue