Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/groupfolders.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2019-10-02 17:49:35 +0300
committerRobin Appelman <robin@icewind.nl>2019-10-02 17:49:35 +0300
commitfd64ab8248125183826b8fc108357ded9d25d063 (patch)
tree18009b3c19de298d13fb40a030f569d4a36979cf
parentaf5bae52dab007a0c13d7258a754811761a3f8bd (diff)
show full path for trashbin tooltiptrash-full-path
-rw-r--r--appinfo/info.xml2
-rw-r--r--lib/Trash/GroupTrashItem.php26
-rw-r--r--lib/Trash/TrashBackend.php22
3 files changed, 42 insertions, 8 deletions
diff --git a/appinfo/info.xml b/appinfo/info.xml
index a888aeb9..fbcd20a2 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -30,7 +30,7 @@ Note: encrypting the contents of group folders is currently not supported.]]></d
<screenshot>https://raw.githubusercontent.com/nextcloud/groupfolders/master/screenshots/permissions.png</screenshot>
<dependencies>
- <nextcloud min-version="17" max-version="17" />
+ <nextcloud min-version="17" max-version="18" />
</dependencies>
<background-jobs>
diff --git a/lib/Trash/GroupTrashItem.php b/lib/Trash/GroupTrashItem.php
index 47535462..1d75a886 100644
--- a/lib/Trash/GroupTrashItem.php
+++ b/lib/Trash/GroupTrashItem.php
@@ -21,10 +21,36 @@
namespace OCA\GroupFolders\Trash;
+use OCA\Files_Trashbin\Trash\ITrashBackend;
use OCA\Files_Trashbin\Trash\TrashItem;
+use OCP\Files\FileInfo;
+use OCP\IUser;
class GroupTrashItem extends TrashItem {
+ private $mountPoint;
+
+ public function __construct(
+ ITrashBackend $backend,
+ string $originalLocation,
+ int $deletedTime,
+ string $trashPath,
+ FileInfo $fileInfo,
+ IUser $user,
+ string $mountPoint
+ ) {
+ parent::__construct($backend, $originalLocation, $deletedTime, $trashPath, $fileInfo, $user);
+ $this->mountPoint = $mountPoint;
+ }
+
public function isRootItem(): bool {
return substr_count($this->getTrashPath(), '/') === 2;
}
+
+ public function getGroupFolderMountPoint(): string {
+ return $this->mountPoint;
+ }
+
+ public function getTitle(): string {
+ return $this->getGroupFolderMountPoint() . '/' . $this->getOriginalLocation();
+ }
}
diff --git a/lib/Trash/TrashBackend.php b/lib/Trash/TrashBackend.php
index b5df6fbc..d5fe1c0d 100644
--- a/lib/Trash/TrashBackend.php
+++ b/lib/Trash/TrashBackend.php
@@ -60,12 +60,13 @@ class TrashBackend implements ITrashBackend {
public function listTrashRoot(IUser $user): array {
$folders = $this->folderManager->getFoldersForUser($user);
- return $this->getTrashForFolders($user, array_map(function (array $folder) {
- return $folder['folder_id'];
- }, $folders));
+ return $this->getTrashForFolders($user, $folders);
}
public function listTrashFolder(ITrashItem $trashItem): array {
+ if (!$trashItem instanceof GroupTrashItem) {
+ return [];
+ }
$user = $trashItem->getUser();
$folder = $this->getNodeForTrashItem($user, $trashItem);
if (!$folder instanceof Folder) {
@@ -79,7 +80,8 @@ class TrashBackend implements ITrashBackend {
$trashItem->getDeletedTime(),
$trashItem->getTrashPath() . '/' . $node->getName(),
$node,
- $user
+ $user,
+ $trashItem->getGroupFolderMountPoint()
);
}, $content);
}
@@ -199,7 +201,10 @@ class TrashBackend implements ITrashBackend {
}
}
- private function getTrashForFolders(IUser $user, array $folderIds) {
+ private function getTrashForFolders(IUser $user, array $folders) {
+ $folderIds = array_map(function(array $folder) {
+ return $folder['folder_id'];
+ }, $folders);
$rows = $this->trashManager->listTrashForFolders($folderIds);
$indexedRows = [];
foreach ($rows as $row) {
@@ -207,7 +212,9 @@ class TrashBackend implements ITrashBackend {
$indexedRows[$key] = $row;
}
$items = [];
- foreach ($folderIds as $folderId) {
+ foreach ($folders as $folder) {
+ $folderId = $folder['folder_id'];
+ $mountPoint = $folder['mount_point'];
$trashFolder = $this->getTrashFolder($folderId);
$content = $trashFolder->getDirectoryListing();
foreach ($content as $item) {
@@ -224,7 +231,8 @@ class TrashBackend implements ITrashBackend {
$timestamp,
'/' . $folderId . '/' . $item->getName(),
$info,
- $user
+ $user,
+ $mountPoint
);
}
}