diff --git a/.github/workflows/integration-pgsql.yml b/.github/workflows/integration-pgsql.yml index 1d757796621..3ca3dcaa26f 100644 --- a/.github/workflows/integration-pgsql.yml +++ b/.github/workflows/integration-pgsql.yml @@ -69,7 +69,7 @@ jobs: - 'sharing-3' - 'sharing-4' php-versions: ['8.3'] - server-versions: ['master'] + server-versions: ['share-update-check-single'] guests-versions: ['main'] circles-versions: ['master'] notifications-versions: ['master'] diff --git a/lib/Share/RoomShareProvider.php b/lib/Share/RoomShareProvider.php index 88f76b527c3..8c3663f992a 100644 --- a/lib/Share/RoomShareProvider.php +++ b/lib/Share/RoomShareProvider.php @@ -831,6 +831,8 @@ private function _getSharedWith( return []; } + $attachmentFolder = null; + /** @var IShare[] $shares */ $shares = []; @@ -857,11 +859,13 @@ private function _getSharedWith( $qb->andWhere($qb->expr()->eq('s.file_source', $qb->createNamedParameter($node->getId()))); } - if ($path !== null) { - $qb->leftJoin('s', 'share', 'sc', $qb->expr()->eq('s.id', 'sc.parent')) - ->andWhere($qb->expr()->eq('sc.share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERROOM))) - ->andWhere($qb->expr()->eq('sc.share_with', $qb->createNamedParameter($userId))); + $qb->leftJoin('s', 'share', 'sc', $qb->expr()->eq('s.id', 'sc.parent')) + ->andWhere($qb->expr()->eq('sc.share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERROOM))) + ->andWhere($qb->expr()->eq('sc.share_with', $qb->createNamedParameter($userId))); + $qb->selectAlias('sc.file_target', 'sc_file_target') + ->selectAlias('sc.permissions', 'sc_permissions'); + if ($path !== null) { if ($forChildren) { $qb->andWhere($qb->expr()->like('sc.file_target', $qb->createNamedParameter($this->dbConnection->escapeLikeParameter($path) . '_%'))); } else { @@ -892,12 +896,22 @@ private function _getSharedWith( $share = $this->createShareObject($data); $shares[$share->getId()] = $share; + + if (array_key_exists('sc_file_target', $data) && $data['sc_file_target'] === null) { + if ($attachmentFolder === null) { + $talkConfig = \OCP\Server::get(\OCA\Talk\Config::class); + $attachmentFolder = $talkConfig->getAttachmentFolder($userId); + } + $share->setTarget(str_replace(self::TALK_FOLDER_PLACEHOLDER, $attachmentFolder, $share->getTarget())); + $this->move($share, $userId); + } else { + $share->setTarget($data['sc_file_target']); + $share->setPermissions((int)$data['sc_permissions']); + } } $cursor->closeCursor(); } - $shares = $this->resolveSharesForRecipient($shares, $userId, true); - return $shares; } diff --git a/tests/integration/features/sharing-1/create.feature b/tests/integration/features/sharing-1/create.feature index 56ec7538efd..3a0f9342ec5 100644 --- a/tests/integration/features/sharing-1/create.feature +++ b/tests/integration/features/sharing-1/create.feature @@ -350,7 +350,7 @@ Feature: sharing-1/create | item_type | file | | mimetype | text/plain | | storage_id | home::participant2 | - | file_target | /{TALK_PLACEHOLDER}/welcome (2).txt | + | file_target | /Talk/welcome (2).txt | | share_with | group room | | share_with_displayname | Group room | And user "participant3" gets last share