Add parent for invisible link shares
This commit is contained in:
parent
73e3737777
commit
4533cb9c59
|
@ -118,6 +118,10 @@ class DefaultShareProvider implements IShareProvider {
|
|||
if ($share->getExpirationDate() !== null) {
|
||||
$qb->setValue('expiration', $qb->createNamedParameter($share->getExpirationDate(), 'datetime'));
|
||||
}
|
||||
|
||||
if (method_exists($share, 'getParent')) {
|
||||
$qb->setValue('parent', $qb->createNamedParameter($share->getParent()));
|
||||
}
|
||||
} else {
|
||||
throw new \Exception('invalid share type!');
|
||||
}
|
||||
|
|
|
@ -414,6 +414,28 @@ class Manager implements IManager {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To make sure we don't get invisible link shares we set the parent
|
||||
* of a link if it is a reshare. This is a quick word around
|
||||
* until we can properly display multiple link shares in the UI
|
||||
*
|
||||
* See: https://github.com/owncloud/core/issues/22295
|
||||
*
|
||||
* FIXME: Remove once multiple link shares can be properly displayed
|
||||
*
|
||||
* @param \OCP\Share\IShare $share
|
||||
*/
|
||||
protected function setLinkParent(\OCP\Share\IShare $share) {
|
||||
|
||||
// No sense in checking if the method is not there.
|
||||
if (method_exists($share, 'setParent')) {
|
||||
$storage = $share->getNode()->getStorage();
|
||||
if ($storage->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) {
|
||||
$share->setParent($storage->getShareId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param File|Folder $path
|
||||
*/
|
||||
|
@ -470,6 +492,7 @@ class Manager implements IManager {
|
|||
$this->groupCreateChecks($share);
|
||||
} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
|
||||
$this->linkCreateChecks($share);
|
||||
$this->setLinkParent($share);
|
||||
|
||||
/*
|
||||
* For now ignore a set token.
|
||||
|
|
|
@ -1549,6 +1549,7 @@ class ManagerTest extends \Test\TestCase {
|
|||
'pathCreateChecks',
|
||||
'validateExpirationDate',
|
||||
'verifyPassword',
|
||||
'setLinkParent',
|
||||
])
|
||||
->getMock();
|
||||
|
||||
|
@ -1589,6 +1590,9 @@ class ManagerTest extends \Test\TestCase {
|
|||
$manager->expects($this->once())
|
||||
->method('verifyPassword')
|
||||
->with('password');
|
||||
$manager->expects($this->once())
|
||||
->method('setLinkParent')
|
||||
->with($share);
|
||||
|
||||
$this->hasher->expects($this->once())
|
||||
->method('hash')
|
||||
|
|
Loading…
Reference in New Issue