mirror of
https://github.com/netzbegruenung/groupfolders.git
synced 2024-05-07 19:53:40 +02:00
show full path for trashbin tooltip
This commit is contained in:
parent
c1826286d3
commit
1db5c303c1
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,12 +67,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) {
|
||||
|
@ -86,7 +87,8 @@ class TrashBackend implements ITrashBackend {
|
|||
$trashItem->getDeletedTime(),
|
||||
$trashItem->getTrashPath() . '/' . $node->getName(),
|
||||
$node,
|
||||
$user
|
||||
$user,
|
||||
$trashItem->getGroupFolderMountPoint()
|
||||
);
|
||||
}, $content);
|
||||
}
|
||||
|
@ -216,7 +218,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) {
|
||||
|
@ -224,7 +229,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) {
|
||||
|
@ -244,7 +251,8 @@ class TrashBackend implements ITrashBackend {
|
|||
$timestamp,
|
||||
'/' . $folderId . '/' . $item->getName(),
|
||||
$info,
|
||||
$user
|
||||
$user,
|
||||
$mountPoint
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue