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

github.com/nextcloud/maps.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArne Hamann <git@arne.email>2022-04-25 15:32:43 +0300
committerArne Hamann <git@arne.email>2022-05-19 10:49:35 +0300
commit6f141bf8556d1c2bcc6fd6c4791dcb5f333806a2 (patch)
tree3e435ed07cd023af4fe4c6205bbbc3d6f02e66a4 /lib
parentd9ed9cab7ae8fc6910ab58a77874f8d8be89ef48 (diff)
Fixed tracks in shares and sharing to group
Signed-off-by: Arne Hamann <git@arne.email>
Diffstat (limited to 'lib')
-rw-r--r--lib/Hooks/FileHooks.php38
-rw-r--r--lib/Service/TracksService.php3
2 files changed, 23 insertions, 18 deletions
diff --git a/lib/Hooks/FileHooks.php b/lib/Hooks/FileHooks.php
index 2b063e9c..8655a7b6 100644
--- a/lib/Hooks/FileHooks.php
+++ b/lib/Hooks/FileHooks.php
@@ -115,22 +115,28 @@ class FileHooks {
}
public function postShare($params) {
- if ($params['shareType'] === Share::SHARE_TYPE_USER) {
- if ($params['itemType'] === 'file') {
- //$targetFilePath = $params['itemTarget'];
- //$sourceUserId = $params['uidOwner'];
- $targetUserId = $params['shareWith'];
- $fileId = $params['fileSource']; // or itemSource
- $this->photofilesService->addByFileIdUserId($fileId, $targetUserId);
- $this->tracksService->safeAddByFileIdUserId($fileId, $targetUserId);
- }
- else if ($params['itemType'] === 'folder') {
- $targetUserId = $params['shareWith'];
- $dirId = $params['fileSource']; // or itemSource
- $this->photofilesService->addByFolderIdUserId($dirId, $targetUserId);
- $this->tracksService->safeAddByFolderIdUserId($dirId, $targetUserId);
- }
- }
+ if ($params['itemType'] === 'file') {
+ //$targetFilePath = $params['itemTarget'];
+ //$sourceUserId = $params['uidOwner'];
+ $fileId = $params['fileSource']; // or itemSource
+ $files = $this->root->getById($fileId);
+ if (empty($files)) {
+ return;
+ }
+ $file = array_shift($files);
+ $this->photofilesService->addByFile($file,);
+ $this->tracksService->safeAddByFile($file);
+ }
+ else if ($params['itemType'] === 'folder') {
+ $dirId = $params['fileSource']; // or itemSource
+ $folders = $this->root->getById($dirId);
+ if (empty($folders)) {
+ return;
+ }
+ $folder = array_shift($folders);
+ $this->photofilesService->addByFolder($folder);
+ $this->tracksService->safeAddByFolder($folder);
+ }
}
public function postUnShare($params) {
diff --git a/lib/Service/TracksService.php b/lib/Service/TracksService.php
index 3a9fda10..fd8853b5 100644
--- a/lib/Service/TracksService.php
+++ b/lib/Service/TracksService.php
@@ -92,8 +92,7 @@ class TracksService {
}
public function safeAddByFolderIdUserId($folderId, $userId) {
- $userFolder = $this->root->getUserFolder($userId);
- $folders = $userFolder->getById($folderId);
+ $folders = $this->root->getById($folderId);
if (empty($folders)) {
return;
}