4646use  OCP \IConfig ;
4747use  OCP \IGroupManager ;
4848use  OCP \IL10N ;
49+ use  OCP \IPreview ;
4950use  OCP \IRequest ;
5051use  OCP \IServerContainer ;
5152use  OCP \IURLGenerator ;
@@ -586,6 +587,7 @@ public function dataGetShare() {
586587			'label '  => '' ,
587588			'displayname_file_owner '  => 'ownerDisplay ' ,
588589			'mimetype '  => 'myMimeType ' ,
590+ 			'has_preview '  => false ,
589591			'hide_download '  => 0 ,
590592			'can_edit '  => false ,
591593			'can_delete '  => false ,
@@ -634,6 +636,7 @@ public function dataGetShare() {
634636			'label '  => '' ,
635637			'displayname_file_owner '  => 'ownerDisplay ' ,
636638			'mimetype '  => 'myFolderMimeType ' ,
639+ 			'has_preview '  => false ,
637640			'hide_download '  => 0 ,
638641			'can_edit '  => false ,
639642			'can_delete '  => false ,
@@ -689,6 +692,7 @@ public function dataGetShare() {
689692			'label '  => 'first link share ' ,
690693			'displayname_file_owner '  => 'ownerDisplay ' ,
691694			'mimetype '  => 'myFolderMimeType ' ,
695+ 			'has_preview '  => false ,
692696			'hide_download '  => 0 ,
693697			'can_edit '  => false ,
694698			'can_delete '  => false ,
@@ -3373,19 +3377,24 @@ public function dataFormatShare() {
33733377		$ file$ this getMockBuilder (File::class)->getMock ();
33743378		$ folder$ this getMockBuilder (Folder::class)->getMock ();
33753379		$ parent$ this getMockBuilder (Folder::class)->getMock ();
3380+ 		$ fileWithPreview$ this getMockBuilder (File::class)->getMock ();
33763381
33773382		$ filemethod ('getMimeType ' )->willReturn ('myMimeType ' );
33783383		$ foldermethod ('getMimeType ' )->willReturn ('myFolderMimeType ' );
3384+ 		$ fileWithPreviewmethod ('getMimeType ' )->willReturn ('mimeWithPreview ' );
33793385
33803386		$ filemethod ('getPath ' )->willReturn ('file ' );
33813387		$ foldermethod ('getPath ' )->willReturn ('folder ' );
3388+ 		$ fileWithPreviewmethod ('getPath ' )->willReturn ('fileWithPreview ' );
33823389
33833390		$ parentmethod ('getId ' )->willReturn (1 );
33843391		$ foldermethod ('getId ' )->willReturn (2 );
33853392		$ filemethod ('getId ' )->willReturn (3 );
3393+ 		$ fileWithPreviewmethod ('getId ' )->willReturn (4 );
33863394
33873395		$ filemethod ('getParent ' )->willReturn ($ parent
33883396		$ foldermethod ('getParent ' )->willReturn ($ parent
3397+ 		$ fileWithPreviewmethod ('getParent ' )->willReturn ($ parent
33893398
33903399		$ cache$ this getMockBuilder ('OCP\Files\Cache\ICache ' )->getMock ();
33913400		$ cachemethod ('getNumericStorageId ' )->willReturn (100 );
@@ -3395,6 +3404,7 @@ public function dataFormatShare() {
33953404
33963405		$ filemethod ('getStorage ' )->willReturn ($ storage
33973406		$ foldermethod ('getStorage ' )->willReturn ($ storage
3407+ 		$ fileWithPreviewmethod ('getStorage ' )->willReturn ($ storage
33983408
33993409		$ owner$ this getMockBuilder (IUser::class)->getMock ();
34003410		$ ownermethod ('getDisplayName ' )->willReturn ('ownerDN ' );
@@ -3445,6 +3455,7 @@ public function dataFormatShare() {
34453455				'label '  => null ,
34463456				'mail_send '  => 0 ,
34473457				'mimetype '  => 'myMimeType ' ,
3458+ 				'has_preview '  => false ,
34483459				'hide_download '  => 0 ,
34493460				'can_edit '  => false ,
34503461				'can_delete '  => false ,
@@ -3478,6 +3489,7 @@ public function dataFormatShare() {
34783489				'share_with_displayname '  => 'recipientDN ' ,
34793490				'mail_send '  => 0 ,
34803491				'mimetype '  => 'myMimeType ' ,
3492+ 				'has_preview '  => false ,
34813493				'hide_download '  => 0 ,
34823494				'can_edit '  => false ,
34833495				'can_delete '  => false ,
@@ -3527,6 +3539,7 @@ public function dataFormatShare() {
35273539				'share_with_displayname '  => 'recipient ' ,
35283540				'mail_send '  => 0 ,
35293541				'mimetype '  => 'myMimeType ' ,
3542+ 				'has_preview '  => false ,
35303543				'hide_download '  => 0 ,
35313544				'can_edit '  => false ,
35323545				'can_delete '  => false ,
@@ -3572,6 +3585,7 @@ public function dataFormatShare() {
35723585				'share_with_displayname '  => 'recipient ' ,
35733586				'mail_send '  => 0 ,
35743587				'mimetype '  => 'myMimeType ' ,
3588+ 				'has_preview '  => false ,
35753589				'hide_download '  => 0 ,
35763590				'can_edit '  => true ,
35773591				'can_delete '  => true ,
@@ -3619,6 +3633,7 @@ public function dataFormatShare() {
36193633				'share_with_displayname '  => 'recipientGroupDisplayName ' ,
36203634				'mail_send '  => 0 ,
36213635				'mimetype '  => 'myMimeType ' ,
3636+ 				'has_preview '  => false ,
36223637				'hide_download '  => 0 ,
36233638				'can_edit '  => false ,
36243639				'can_delete '  => false ,
@@ -3664,6 +3679,7 @@ public function dataFormatShare() {
36643679				'share_with_displayname '  => 'recipientGroup2 ' ,
36653680				'mail_send '  => 0 ,
36663681				'mimetype '  => 'myMimeType ' ,
3682+ 				'has_preview '  => false ,
36673683				'hide_download '  => 0 ,
36683684				'can_edit '  => false ,
36693685				'can_delete '  => false ,
@@ -3715,6 +3731,7 @@ public function dataFormatShare() {
37153731				'mail_send '  => 0 ,
37163732				'url '  => 'myLink ' ,
37173733				'mimetype '  => 'myMimeType ' ,
3734+ 				'has_preview '  => false ,
37183735				'hide_download '  => 0 ,
37193736				'can_edit '  => false ,
37203737				'can_delete '  => false ,
@@ -3767,6 +3784,7 @@ public function dataFormatShare() {
37673784				'mail_send '  => 0 ,
37683785				'url '  => 'myLink ' ,
37693786				'mimetype '  => 'myMimeType ' ,
3787+ 				'has_preview '  => false ,
37703788				'hide_download '  => 0 ,
37713789				'can_edit '  => false ,
37723790				'can_delete '  => false ,
@@ -3812,6 +3830,7 @@ public function dataFormatShare() {
38123830				'share_with_displayname '  => 'foobar ' ,
38133831				'mail_send '  => 0 ,
38143832				'mimetype '  => 'myFolderMimeType ' ,
3833+ 				'has_preview '  => false ,
38153834				'hide_download '  => 0 ,
38163835				'can_edit '  => false ,
38173836				'can_delete '  => false ,
@@ -3860,6 +3879,7 @@ public function dataFormatShare() {
38603879				'share_with_avatar '  => 'path/to/the/avatar ' ,
38613880				'mail_send '  => 0 ,
38623881				'mimetype '  => 'myFolderMimeType ' ,
3882+ 				'has_preview '  => false ,
38633883				'hide_download '  => 0 ,
38643884				'can_edit '  => false ,
38653885				'can_delete '  => false ,
@@ -3906,6 +3926,7 @@ public function dataFormatShare() {
39063926				'share_with_avatar '  => '' ,
39073927				'mail_send '  => 0 ,
39083928				'mimetype '  => 'myFolderMimeType ' ,
3929+ 				'has_preview '  => false ,
39093930				'hide_download '  => 0 ,
39103931				'can_edit '  => false ,
39113932				'can_delete '  => false ,
@@ -3952,6 +3973,7 @@ public function dataFormatShare() {
39523973				'share_with_avatar '  => '' ,
39533974				'mail_send '  => 0 ,
39543975				'mimetype '  => 'myFolderMimeType ' ,
3976+ 				'has_preview '  => false ,
39553977				'hide_download '  => 0 ,
39563978				'can_edit '  => false ,
39573979				'can_delete '  => false ,
@@ -4012,6 +4034,7 @@ public function dataFormatShare() {
40124034				'share_with_displayname '  => 'mail display name ' ,
40134035				'mail_send '  => 0 ,
40144036				'mimetype '  => 'myFolderMimeType ' ,
4037+ 				'has_preview '  => false ,
40154038				'password '  => 'password ' ,
40164039				'send_password_by_talk '  => false ,
40174040				'hide_download '  => 0 ,
@@ -4060,6 +4083,7 @@ public function dataFormatShare() {
40604083				'share_with_displayname '  => 'mail display name ' ,
40614084				'mail_send '  => 0 ,
40624085				'mimetype '  => 'myFolderMimeType ' ,
4086+ 				'has_preview '  => false ,
40634087				'password '  => 'password ' ,
40644088				'send_password_by_talk '  => true ,
40654089				'hide_download '  => 0 ,
@@ -4068,6 +4092,54 @@ public function dataFormatShare() {
40684092			], $ sharefalse 
40694093		];
40704094
4095+ 		// Preview is available 
4096+ 		$ shareOC ::$ servergetShareManager ()->newShare ();
4097+ 		$ sharesetShareType (IShare::TYPE_USER )
4098+ 			->setSharedWith ('recipient ' )
4099+ 			->setSharedBy ('initiator ' )
4100+ 			->setShareOwner ('currentUser ' )
4101+ 			->setPermissions (\OCP \Constants::PERMISSION_READ )
4102+ 			->setNode ($ fileWithPreview
4103+ 			->setShareTime (new  \DateTime ('2000-01-01T00:01:02 ' ))
4104+ 			->setTarget ('myTarget ' )
4105+ 			->setNote ('personal note ' )
4106+ 			->setId (42 );
4107+ 
4108+ 		$ result
4109+ 			[
4110+ 				'id '  => 42 ,
4111+ 				'share_type '  => IShare::TYPE_USER ,
4112+ 				'uid_owner '  => 'initiator ' ,
4113+ 				'displayname_owner '  => 'initiator ' ,
4114+ 				'permissions '  => 1 ,
4115+ 				'stime '  => 946684862 ,
4116+ 				'parent '  => null ,
4117+ 				'expiration '  => null ,
4118+ 				'token '  => null ,
4119+ 				'uid_file_owner '  => 'currentUser ' ,
4120+ 				'displayname_file_owner '  => 'currentUser ' ,
4121+ 				'note '  => 'personal note ' ,
4122+ 				'label '  => null ,
4123+ 				'path '  => 'fileWithPreview ' ,
4124+ 				'item_type '  => 'file ' ,
4125+ 				'storage_id '  => 'storageId ' ,
4126+ 				'storage '  => 100 ,
4127+ 				'item_source '  => 4 ,
4128+ 				'file_source '  => 4 ,
4129+ 				'file_parent '  => 1 ,
4130+ 				'file_target '  => 'myTarget ' ,
4131+ 				'share_with '  => 'recipient ' ,
4132+ 				'share_with_displayname '  => 'recipient ' ,
4133+ 				'mail_send '  => 0 ,
4134+ 				'mimetype '  => 'mimeWithPreview ' ,
4135+ 				'has_preview '  => true ,
4136+ 				'hide_download '  => 0 ,
4137+ 				'can_edit '  => true ,
4138+ 				'can_delete '  => true ,
4139+ 				'status '  => [],
4140+ 			], $ sharefalse 
4141+ 		];
4142+ 
40714143		return  $ result
40724144	}
40734145
@@ -4204,6 +4276,7 @@ public function dataFormatRoomShare() {
42044276				'share_with_displayname '  => '' ,
42054277				'mail_send '  => 0 ,
42064278				'mimetype '  => 'myMimeType ' ,
4279+ 				'has_preview '  => false ,
42074280				'hide_download '  => 0 ,
42084281				'label '  => '' ,
42094282				'can_edit '  => false ,
@@ -4249,6 +4322,7 @@ public function dataFormatRoomShare() {
42494322				'share_with_displayname '  => 'recipientRoomName ' ,
42504323				'mail_send '  => 0 ,
42514324				'mimetype '  => 'myMimeType ' ,
4325+ 				'has_preview '  => false ,
42524326				'hide_download '  => 0 ,
42534327				'label '  => '' ,
42544328				'can_edit '  => false ,
0 commit comments