Indicate preview availability in share api responses
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
This commit is contained in:
parent
96f8cd0736
commit
af5a94dc3d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -353,6 +353,7 @@
|
||||||
id: share.file_source,
|
id: share.file_source,
|
||||||
icon: OC.MimeType.getIconUrl(share.mimetype),
|
icon: OC.MimeType.getIconUrl(share.mimetype),
|
||||||
mimetype: share.mimetype,
|
mimetype: share.mimetype,
|
||||||
|
hasPreview: share.has_preview,
|
||||||
tags: share.tags || []
|
tags: share.tags || []
|
||||||
}
|
}
|
||||||
if (share.item_type === 'folder') {
|
if (share.item_type === 'folder') {
|
||||||
|
|
|
@ -59,6 +59,7 @@ use OCP\Files\NotFoundException;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IGroupManager;
|
use OCP\IGroupManager;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
use OCP\IPreview;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IServerContainer;
|
use OCP\IServerContainer;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
|
@ -100,6 +101,8 @@ class ShareAPIController extends OCSController {
|
||||||
private $appManager;
|
private $appManager;
|
||||||
/** @var IServerContainer */
|
/** @var IServerContainer */
|
||||||
private $serverContainer;
|
private $serverContainer;
|
||||||
|
/** @var IPreview */
|
||||||
|
private $previewManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Share20OCS constructor.
|
* Share20OCS constructor.
|
||||||
|
@ -129,7 +132,8 @@ class ShareAPIController extends OCSController {
|
||||||
IL10N $l10n,
|
IL10N $l10n,
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
IAppManager $appManager,
|
IAppManager $appManager,
|
||||||
IServerContainer $serverContainer
|
IServerContainer $serverContainer,
|
||||||
|
IPreview $previewManager
|
||||||
) {
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
|
@ -144,6 +148,7 @@ class ShareAPIController extends OCSController {
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->appManager = $appManager;
|
$this->appManager = $appManager;
|
||||||
$this->serverContainer = $serverContainer;
|
$this->serverContainer = $serverContainer;
|
||||||
|
$this->previewManager = $previewManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -204,6 +209,7 @@ class ShareAPIController extends OCSController {
|
||||||
}
|
}
|
||||||
|
|
||||||
$result['mimetype'] = $node->getMimetype();
|
$result['mimetype'] = $node->getMimetype();
|
||||||
|
$result['has_preview'] = $this->previewManager->isAvailable($node);
|
||||||
$result['storage_id'] = $node->getStorage()->getId();
|
$result['storage_id'] = $node->getStorage()->getId();
|
||||||
$result['storage'] = $node->getStorage()->getCache()->getNumericStorageId();
|
$result['storage'] = $node->getStorage()->getCache()->getNumericStorageId();
|
||||||
$result['item_source'] = $node->getId();
|
$result['item_source'] = $node->getId();
|
||||||
|
|
|
@ -43,6 +43,7 @@ use OCP\AppFramework\OCS\OCSForbiddenException;
|
||||||
use OCP\AppFramework\OCS\OCSNotFoundException;
|
use OCP\AppFramework\OCS\OCSNotFoundException;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
use OCP\IPreview;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IServerContainer;
|
use OCP\IServerContainer;
|
||||||
use OCP\Share\IShare;
|
use OCP\Share\IShare;
|
||||||
|
@ -114,6 +115,7 @@ class ApiTest extends TestCase {
|
||||||
$config = $this->createMock(IConfig::class);
|
$config = $this->createMock(IConfig::class);
|
||||||
$appManager = $this->createMock(IAppManager::class);
|
$appManager = $this->createMock(IAppManager::class);
|
||||||
$serverContainer = $this->createMock(IServerContainer::class);
|
$serverContainer = $this->createMock(IServerContainer::class);
|
||||||
|
$previewManager = $this->createMock(IPreview::class);
|
||||||
|
|
||||||
return new ShareAPIController(
|
return new ShareAPIController(
|
||||||
self::APP_NAME,
|
self::APP_NAME,
|
||||||
|
@ -127,7 +129,8 @@ class ApiTest extends TestCase {
|
||||||
$l,
|
$l,
|
||||||
$config,
|
$config,
|
||||||
$appManager,
|
$appManager,
|
||||||
$serverContainer
|
$serverContainer,
|
||||||
|
$previewManager
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ use OCP\Files\Storage;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IGroupManager;
|
use OCP\IGroupManager;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
use OCP\IPreview;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IServerContainer;
|
use OCP\IServerContainer;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
|
@ -105,6 +106,9 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
/** @var IServerContainer|\PHPUnit_Framework_MockObject_MockObject */
|
/** @var IServerContainer|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $serverContainer;
|
private $serverContainer;
|
||||||
|
|
||||||
|
/** @var IPreview|\PHPUnit\Framework\MockObject\MockObject */
|
||||||
|
private $previewManager;
|
||||||
|
|
||||||
protected function setUp(): void {
|
protected function setUp(): void {
|
||||||
$this->shareManager = $this->createMock(IManager::class);
|
$this->shareManager = $this->createMock(IManager::class);
|
||||||
$this->shareManager
|
$this->shareManager
|
||||||
|
@ -129,6 +133,11 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->config = $this->createMock(IConfig::class);
|
$this->config = $this->createMock(IConfig::class);
|
||||||
$this->appManager = $this->createMock(IAppManager::class);
|
$this->appManager = $this->createMock(IAppManager::class);
|
||||||
$this->serverContainer = $this->createMock(IServerContainer::class);
|
$this->serverContainer = $this->createMock(IServerContainer::class);
|
||||||
|
$this->previewManager = $this->createMock(IPreview::class);
|
||||||
|
$this->previewManager->method('isAvailable')
|
||||||
|
->willReturnCallback(function ($fileInfo) {
|
||||||
|
return $fileInfo->getMimeType() === 'mimeWithPreview';
|
||||||
|
});
|
||||||
|
|
||||||
$this->ocs = new ShareAPIController(
|
$this->ocs = new ShareAPIController(
|
||||||
$this->appName,
|
$this->appName,
|
||||||
|
@ -142,7 +151,8 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->l,
|
$this->l,
|
||||||
$this->config,
|
$this->config,
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer
|
$this->serverContainer,
|
||||||
|
$this->previewManager
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +173,8 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->l,
|
$this->l,
|
||||||
$this->config,
|
$this->config,
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer
|
$this->serverContainer,
|
||||||
|
$this->previewManager
|
||||||
])->setMethods(['formatShare'])
|
])->setMethods(['formatShare'])
|
||||||
->getMock();
|
->getMock();
|
||||||
}
|
}
|
||||||
|
@ -586,6 +597,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'displayname_file_owner' => 'ownerDisplay',
|
'displayname_file_owner' => 'ownerDisplay',
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -634,6 +646,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'displayname_file_owner' => 'ownerDisplay',
|
'displayname_file_owner' => 'ownerDisplay',
|
||||||
'mimetype' => 'myFolderMimeType',
|
'mimetype' => 'myFolderMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -689,6 +702,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'label' => 'first link share',
|
'label' => 'first link share',
|
||||||
'displayname_file_owner' => 'ownerDisplay',
|
'displayname_file_owner' => 'ownerDisplay',
|
||||||
'mimetype' => 'myFolderMimeType',
|
'mimetype' => 'myFolderMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -716,7 +730,8 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->l,
|
$this->l,
|
||||||
$this->config,
|
$this->config,
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer
|
$this->serverContainer,
|
||||||
|
$this->previewManager
|
||||||
])->setMethods(['canAccessShare'])
|
])->setMethods(['canAccessShare'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -1335,7 +1350,8 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->l,
|
$this->l,
|
||||||
$this->config,
|
$this->config,
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer
|
$this->serverContainer,
|
||||||
|
$this->previewManager
|
||||||
])->setMethods(['formatShare'])
|
])->setMethods(['formatShare'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -1678,7 +1694,8 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->l,
|
$this->l,
|
||||||
$this->config,
|
$this->config,
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer
|
$this->serverContainer,
|
||||||
|
$this->previewManager
|
||||||
])->setMethods(['formatShare'])
|
])->setMethods(['formatShare'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -1778,7 +1795,8 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->l,
|
$this->l,
|
||||||
$this->config,
|
$this->config,
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer
|
$this->serverContainer,
|
||||||
|
$this->previewManager
|
||||||
])->setMethods(['formatShare'])
|
])->setMethods(['formatShare'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -2341,7 +2359,8 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->l,
|
$this->l,
|
||||||
$this->config,
|
$this->config,
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer
|
$this->serverContainer,
|
||||||
|
$this->previewManager
|
||||||
])->setMethods(['formatShare'])
|
])->setMethods(['formatShare'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -3373,19 +3392,24 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$file = $this->getMockBuilder(File::class)->getMock();
|
$file = $this->getMockBuilder(File::class)->getMock();
|
||||||
$folder = $this->getMockBuilder(Folder::class)->getMock();
|
$folder = $this->getMockBuilder(Folder::class)->getMock();
|
||||||
$parent = $this->getMockBuilder(Folder::class)->getMock();
|
$parent = $this->getMockBuilder(Folder::class)->getMock();
|
||||||
|
$fileWithPreview = $this->getMockBuilder(File::class)->getMock();
|
||||||
|
|
||||||
$file->method('getMimeType')->willReturn('myMimeType');
|
$file->method('getMimeType')->willReturn('myMimeType');
|
||||||
$folder->method('getMimeType')->willReturn('myFolderMimeType');
|
$folder->method('getMimeType')->willReturn('myFolderMimeType');
|
||||||
|
$fileWithPreview->method('getMimeType')->willReturn('mimeWithPreview');
|
||||||
|
|
||||||
$file->method('getPath')->willReturn('file');
|
$file->method('getPath')->willReturn('file');
|
||||||
$folder->method('getPath')->willReturn('folder');
|
$folder->method('getPath')->willReturn('folder');
|
||||||
|
$fileWithPreview->method('getPath')->willReturn('fileWithPreview');
|
||||||
|
|
||||||
$parent->method('getId')->willReturn(1);
|
$parent->method('getId')->willReturn(1);
|
||||||
$folder->method('getId')->willReturn(2);
|
$folder->method('getId')->willReturn(2);
|
||||||
$file->method('getId')->willReturn(3);
|
$file->method('getId')->willReturn(3);
|
||||||
|
$fileWithPreview->method('getId')->willReturn(4);
|
||||||
|
|
||||||
$file->method('getParent')->willReturn($parent);
|
$file->method('getParent')->willReturn($parent);
|
||||||
$folder->method('getParent')->willReturn($parent);
|
$folder->method('getParent')->willReturn($parent);
|
||||||
|
$fileWithPreview->method('getParent')->willReturn($parent);
|
||||||
|
|
||||||
$cache = $this->getMockBuilder('OCP\Files\Cache\ICache')->getMock();
|
$cache = $this->getMockBuilder('OCP\Files\Cache\ICache')->getMock();
|
||||||
$cache->method('getNumericStorageId')->willReturn(100);
|
$cache->method('getNumericStorageId')->willReturn(100);
|
||||||
|
@ -3395,6 +3419,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
|
|
||||||
$file->method('getStorage')->willReturn($storage);
|
$file->method('getStorage')->willReturn($storage);
|
||||||
$folder->method('getStorage')->willReturn($storage);
|
$folder->method('getStorage')->willReturn($storage);
|
||||||
|
$fileWithPreview->method('getStorage')->willReturn($storage);
|
||||||
|
|
||||||
$owner = $this->getMockBuilder(IUser::class)->getMock();
|
$owner = $this->getMockBuilder(IUser::class)->getMock();
|
||||||
$owner->method('getDisplayName')->willReturn('ownerDN');
|
$owner->method('getDisplayName')->willReturn('ownerDN');
|
||||||
|
@ -3445,6 +3470,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'label' => null,
|
'label' => null,
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -3478,6 +3504,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_displayname' => 'recipientDN',
|
'share_with_displayname' => 'recipientDN',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -3527,6 +3554,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_displayname' => 'recipient',
|
'share_with_displayname' => 'recipient',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -3572,6 +3600,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_displayname' => 'recipient',
|
'share_with_displayname' => 'recipient',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => true,
|
'can_edit' => true,
|
||||||
'can_delete' => true,
|
'can_delete' => true,
|
||||||
|
@ -3619,6 +3648,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_displayname' => 'recipientGroupDisplayName',
|
'share_with_displayname' => 'recipientGroupDisplayName',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -3664,6 +3694,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_displayname' => 'recipientGroup2',
|
'share_with_displayname' => 'recipientGroup2',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -3715,6 +3746,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'url' => 'myLink',
|
'url' => 'myLink',
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -3767,6 +3799,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'url' => 'myLink',
|
'url' => 'myLink',
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -3812,6 +3845,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_displayname' => 'foobar',
|
'share_with_displayname' => 'foobar',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myFolderMimeType',
|
'mimetype' => 'myFolderMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -3860,6 +3894,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_avatar' => 'path/to/the/avatar',
|
'share_with_avatar' => 'path/to/the/avatar',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myFolderMimeType',
|
'mimetype' => 'myFolderMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -3906,6 +3941,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_avatar' => '',
|
'share_with_avatar' => '',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myFolderMimeType',
|
'mimetype' => 'myFolderMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -3952,6 +3988,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_avatar' => '',
|
'share_with_avatar' => '',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myFolderMimeType',
|
'mimetype' => 'myFolderMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
'can_delete' => false,
|
'can_delete' => false,
|
||||||
|
@ -4012,6 +4049,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_displayname' => 'mail display name',
|
'share_with_displayname' => 'mail display name',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myFolderMimeType',
|
'mimetype' => 'myFolderMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'password' => 'password',
|
'password' => 'password',
|
||||||
'send_password_by_talk' => false,
|
'send_password_by_talk' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
|
@ -4060,6 +4098,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_displayname' => 'mail display name',
|
'share_with_displayname' => 'mail display name',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myFolderMimeType',
|
'mimetype' => 'myFolderMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'password' => 'password',
|
'password' => 'password',
|
||||||
'send_password_by_talk' => true,
|
'send_password_by_talk' => true,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
|
@ -4068,6 +4107,53 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
], $share, [], false
|
], $share, [], false
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Preview is available
|
||||||
|
$share = \OC::$server->getShareManager()->newShare();
|
||||||
|
$share->setShareType(IShare::TYPE_USER)
|
||||||
|
->setSharedWith('recipient')
|
||||||
|
->setSharedBy('initiator')
|
||||||
|
->setShareOwner('currentUser')
|
||||||
|
->setPermissions(\OCP\Constants::PERMISSION_READ)
|
||||||
|
->setNode($fileWithPreview)
|
||||||
|
->setShareTime(new \DateTime('2000-01-01T00:01:02'))
|
||||||
|
->setTarget('myTarget')
|
||||||
|
->setNote('personal note')
|
||||||
|
->setId(42);
|
||||||
|
|
||||||
|
$result[] = [
|
||||||
|
[
|
||||||
|
'id' => 42,
|
||||||
|
'share_type' => IShare::TYPE_USER,
|
||||||
|
'uid_owner' => 'initiator',
|
||||||
|
'displayname_owner' => 'initiator',
|
||||||
|
'permissions' => 1,
|
||||||
|
'stime' => 946684862,
|
||||||
|
'parent' => null,
|
||||||
|
'expiration' => null,
|
||||||
|
'token' => null,
|
||||||
|
'uid_file_owner' => 'currentUser',
|
||||||
|
'displayname_file_owner' => 'currentUser',
|
||||||
|
'note' => 'personal note',
|
||||||
|
'label' => null,
|
||||||
|
'path' => 'fileWithPreview',
|
||||||
|
'item_type' => 'file',
|
||||||
|
'storage_id' => 'storageId',
|
||||||
|
'storage' => 100,
|
||||||
|
'item_source' => 4,
|
||||||
|
'file_source' => 4,
|
||||||
|
'file_parent' => 1,
|
||||||
|
'file_target' => 'myTarget',
|
||||||
|
'share_with' => 'recipient',
|
||||||
|
'share_with_displayname' => 'recipient',
|
||||||
|
'mail_send' => 0,
|
||||||
|
'mimetype' => 'mimeWithPreview',
|
||||||
|
'has_preview' => true,
|
||||||
|
'hide_download' => 0,
|
||||||
|
'can_edit' => true,
|
||||||
|
'can_delete' => true,
|
||||||
|
], $share, [], false
|
||||||
|
];
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4204,6 +4290,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_displayname' => '',
|
'share_with_displayname' => '',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
|
@ -4249,6 +4336,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_with_displayname' => 'recipientRoomName',
|
'share_with_displayname' => 'recipientRoomName',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
|
'has_preview' => false,
|
||||||
'hide_download' => 0,
|
'hide_download' => 0,
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'can_edit' => false,
|
'can_edit' => false,
|
||||||
|
|
Loading…
Reference in New Issue