mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 09:13:19 -04:00
Fix remote group share decline+accept code path
When declining a remote group share through the dialog that appears when notifications are off, the mount point is now correctly saved when re-accepting. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
parent
3deffc3161
commit
e67e90afce
2 changed files with 43 additions and 1 deletions
8
apps/files_sharing/lib/External/Manager.php
vendored
8
apps/files_sharing/lib/External/Manager.php
vendored
|
|
@ -334,7 +334,13 @@ class Manager {
|
|||
|
||||
if ($subshare !== null) {
|
||||
try {
|
||||
$this->updateAccepted((int)$subshare['id'], true);
|
||||
$acceptShare = $this->connection->prepare('
|
||||
UPDATE `*PREFIX*share_external`
|
||||
SET `accepted` = ?,
|
||||
`mountpoint` = ?,
|
||||
`mountpoint_hash` = ?
|
||||
WHERE `id` = ? AND `user` = ?');
|
||||
$acceptShare->execute([1, $mountPoint, $hash, $subshare['id'], $this->uid]);
|
||||
$result = true;
|
||||
} catch (Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
|
|
|
|||
|
|
@ -548,6 +548,42 @@ class ManagerTest extends TestCase {
|
|||
$this->assertFalse($this->manager->removeShare($this->uid . '/files/' . $shareData['name']));
|
||||
}
|
||||
|
||||
public function testDeclineThenAcceptGroupShareAgainThroughGroupShare() {
|
||||
[$shareData, $groupShare] = $this->createTestGroupShare();
|
||||
// decline, this creates a declined sub-share
|
||||
$this->assertTrue($this->manager->declineShare($groupShare['id']));
|
||||
$this->verifyDeclinedGroupShare($shareData);
|
||||
|
||||
// this will return sub-entries
|
||||
$openShares = $this->manager->getOpenShares();
|
||||
|
||||
// accept through sub-share
|
||||
$this->assertTrue($this->manager->acceptShare($groupShare['id']));
|
||||
$this->verifyAcceptedGroupShare($shareData, '/SharedFolder');
|
||||
|
||||
// accept a second time
|
||||
$this->assertTrue($this->manager->acceptShare($groupShare['id']));
|
||||
$this->verifyAcceptedGroupShare($shareData, '/SharedFolder');
|
||||
}
|
||||
|
||||
public function testDeclineThenAcceptGroupShareAgainThroughSubShare() {
|
||||
[$shareData, $groupShare] = $this->createTestGroupShare();
|
||||
// decline, this creates a declined sub-share
|
||||
$this->assertTrue($this->manager->declineShare($groupShare['id']));
|
||||
$this->verifyDeclinedGroupShare($shareData);
|
||||
|
||||
// this will return sub-entries
|
||||
$openShares = $this->manager->getOpenShares();
|
||||
|
||||
// accept through sub-share
|
||||
$this->assertTrue($this->manager->acceptShare($openShares[0]['id']));
|
||||
$this->verifyAcceptedGroupShare($shareData);
|
||||
|
||||
// accept a second time
|
||||
$this->assertTrue($this->manager->acceptShare($openShares[0]['id']));
|
||||
$this->verifyAcceptedGroupShare($shareData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $expected
|
||||
* @param array $actual
|
||||
|
|
|
|||
Loading…
Reference in a new issue