Merge pull request #23419 from nextcloud/backport/23350/stable20
[stable20] Inidicate preview availability in share api responses
This commit is contained in:
commit
54fb4c28c4
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') {
|
||||||
|
|
|
@ -62,6 +62,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;
|
||||||
|
@ -106,6 +107,8 @@ class ShareAPIController extends OCSController {
|
||||||
private $serverContainer;
|
private $serverContainer;
|
||||||
/** @var IUserStatusManager */
|
/** @var IUserStatusManager */
|
||||||
private $userStatusManager;
|
private $userStatusManager;
|
||||||
|
/** @var IPreview */
|
||||||
|
private $previewManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Share20OCS constructor.
|
* Share20OCS constructor.
|
||||||
|
@ -137,7 +140,8 @@ class ShareAPIController extends OCSController {
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
IAppManager $appManager,
|
IAppManager $appManager,
|
||||||
IServerContainer $serverContainer,
|
IServerContainer $serverContainer,
|
||||||
IUserStatusManager $userStatusManager
|
IUserStatusManager $userStatusManager,
|
||||||
|
IPreview $previewManager
|
||||||
) {
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
|
@ -153,6 +157,7 @@ class ShareAPIController extends OCSController {
|
||||||
$this->appManager = $appManager;
|
$this->appManager = $appManager;
|
||||||
$this->serverContainer = $serverContainer;
|
$this->serverContainer = $serverContainer;
|
||||||
$this->userStatusManager = $userStatusManager;
|
$this->userStatusManager = $userStatusManager;
|
||||||
|
$this->previewManager = $previewManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,6 +218,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();
|
||||||
|
|
|
@ -44,6 +44,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;
|
||||||
|
@ -117,6 +118,7 @@ class ApiTest extends TestCase {
|
||||||
$appManager = $this->createMock(IAppManager::class);
|
$appManager = $this->createMock(IAppManager::class);
|
||||||
$serverContainer = $this->createMock(IServerContainer::class);
|
$serverContainer = $this->createMock(IServerContainer::class);
|
||||||
$userStatusManager = $this->createMock(IUserStatusManager::class);
|
$userStatusManager = $this->createMock(IUserStatusManager::class);
|
||||||
|
$previewManager = $this->createMock(IPreview::class);
|
||||||
|
|
||||||
return new ShareAPIController(
|
return new ShareAPIController(
|
||||||
self::APP_NAME,
|
self::APP_NAME,
|
||||||
|
@ -131,7 +133,8 @@ class ApiTest extends TestCase {
|
||||||
$config,
|
$config,
|
||||||
$appManager,
|
$appManager,
|
||||||
$serverContainer,
|
$serverContainer,
|
||||||
$userStatusManager
|
$userStatusManager,
|
||||||
|
$previewManager
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,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;
|
||||||
|
@ -109,6 +110,9 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
/** @var IUserStatusManager|\PHPUnit\Framework\MockObject\MockObject */
|
/** @var IUserStatusManager|\PHPUnit\Framework\MockObject\MockObject */
|
||||||
private $userStatusManager;
|
private $userStatusManager;
|
||||||
|
|
||||||
|
/** @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
|
||||||
|
@ -134,6 +138,11 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$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->userStatusManager = $this->createMock(IUserStatusManager::class);
|
$this->userStatusManager = $this->createMock(IUserStatusManager::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,
|
||||||
|
@ -148,7 +157,8 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->config,
|
$this->config,
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer,
|
$this->serverContainer,
|
||||||
$this->userStatusManager
|
$this->userStatusManager,
|
||||||
|
$this->previewManager
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +181,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer,
|
$this->serverContainer,
|
||||||
$this->userStatusManager,
|
$this->userStatusManager,
|
||||||
|
$this->previewManager,
|
||||||
])->setMethods(['formatShare'])
|
])->setMethods(['formatShare'])
|
||||||
->getMock();
|
->getMock();
|
||||||
}
|
}
|
||||||
|
@ -593,6 +604,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,
|
||||||
|
@ -642,6 +654,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,
|
||||||
|
@ -697,6 +710,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,
|
||||||
|
@ -726,6 +740,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer,
|
$this->serverContainer,
|
||||||
$this->userStatusManager,
|
$this->userStatusManager,
|
||||||
|
$this->previewManager,
|
||||||
])->setMethods(['canAccessShare'])
|
])->setMethods(['canAccessShare'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -1346,6 +1361,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer,
|
$this->serverContainer,
|
||||||
$this->userStatusManager,
|
$this->userStatusManager,
|
||||||
|
$this->previewManager,
|
||||||
])->setMethods(['formatShare'])
|
])->setMethods(['formatShare'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -1690,6 +1706,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer,
|
$this->serverContainer,
|
||||||
$this->userStatusManager,
|
$this->userStatusManager,
|
||||||
|
$this->previewManager,
|
||||||
])->setMethods(['formatShare'])
|
])->setMethods(['formatShare'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -1791,6 +1808,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer,
|
$this->serverContainer,
|
||||||
$this->userStatusManager,
|
$this->userStatusManager,
|
||||||
|
$this->previewManager,
|
||||||
])->setMethods(['formatShare'])
|
])->setMethods(['formatShare'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -2355,6 +2373,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$this->appManager,
|
$this->appManager,
|
||||||
$this->serverContainer,
|
$this->serverContainer,
|
||||||
$this->userStatusManager,
|
$this->userStatusManager,
|
||||||
|
$this->previewManager,
|
||||||
])->setMethods(['formatShare'])
|
])->setMethods(['formatShare'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -3386,19 +3405,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);
|
||||||
|
@ -3408,6 +3432,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');
|
||||||
|
@ -3458,6 +3483,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,
|
||||||
|
@ -3492,6 +3518,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,
|
||||||
|
@ -3542,6 +3569,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,
|
||||||
|
@ -3588,6 +3616,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,
|
||||||
|
@ -3636,6 +3665,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,
|
||||||
|
@ -3681,6 +3711,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,
|
||||||
|
@ -3732,6 +3763,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,
|
||||||
|
@ -3784,6 +3816,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,
|
||||||
|
@ -3829,6 +3862,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,
|
||||||
|
@ -3877,6 +3911,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,
|
||||||
|
@ -3923,6 +3958,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,
|
||||||
|
@ -3969,6 +4005,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,
|
||||||
|
@ -4029,6 +4066,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,
|
||||||
|
@ -4077,6 +4115,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,
|
||||||
|
@ -4085,6 +4124,54 @@ 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,
|
||||||
|
'status' => [],
|
||||||
|
], $share, [], false
|
||||||
|
];
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4221,6 +4308,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,
|
||||||
|
@ -4266,6 +4354,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