4444use OCP \Share \IManager ;
4545use OCP \Share \IProviderFactory ;
4646use OCP \Share \IShare ;
47- use OCP \Snowflake \ISnowflakeGenerator ;
4847use OCP \Util ;
4948use Override ;
5049use Psr \Log \LoggerInterface ;
@@ -70,7 +69,6 @@ public function __construct(
7069 private readonly IFilenameValidator $ filenameValidator ,
7170 private readonly IProviderFactory $ shareProviderFactory ,
7271 private readonly SetupManager $ setupManager ,
73- private readonly ISnowflakeGenerator $ snowflakeGenerator ,
7472 private readonly ExternalShareMapper $ externalShareMapper ,
7573 ) {
7674 }
@@ -145,7 +143,7 @@ public function shareReceived(ICloudFederationShare $share): string {
145143 }
146144
147145 $ externalShare = new ExternalShare ();
148- $ externalShare ->setId ($ this -> snowflakeGenerator -> nextId () );
146+ $ externalShare ->setId ();
149147 $ externalShare ->setRemote ($ remote );
150148 $ externalShare ->setRemoteId ($ remoteId );
151149 $ externalShare ->setShareToken ($ token );
@@ -177,9 +175,9 @@ public function shareReceived(ICloudFederationShare $share): string {
177175 ->setType ('remote_share ' )
178176 ->setSubject (RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED , [$ ownerFederatedId , trim ($ name , '/ ' ), $ ownerDisplayName ])
179177 ->setAffectedUser ($ shareWith )
180- ->setObject ('remote_share ' , $ externalShare ->getId (), $ name );
178+ ->setObject ('remote_share ' , ( string ) $ externalShare ->getId (), $ name );
181179 Server::get (IActivityManager::class)->publish ($ event );
182- $ this ->notifyAboutNewShare ($ shareWith , $ externalShare ->getId (), $ ownerFederatedId , $ sharedByFederatedId , $ name , $ ownerDisplayName );
180+ $ this ->notifyAboutNewShare ($ shareWith , ( string ) $ externalShare ->getId (), $ ownerFederatedId , $ sharedByFederatedId , $ name , $ ownerDisplayName );
183181
184182 // If auto-accept is enabled, accept the share
185183 if ($ this ->federatedShareProvider ->isFederatedTrustedShareAutoAccept () && $ trustedServers ?->isTrustedServer($ remote ) === true ) {
@@ -193,9 +191,9 @@ public function shareReceived(ICloudFederationShare $share): string {
193191 ->setType ('remote_share ' )
194192 ->setSubject (RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED , [$ ownerFederatedId , trim ($ name , '/ ' ), $ ownerDisplayName ])
195193 ->setAffectedUser ($ user ->getUID ())
196- ->setObject ('remote_share ' , $ externalShare ->getId (), $ name );
194+ ->setObject ('remote_share ' , ( string ) $ externalShare ->getId (), $ name );
197195 Server::get (IActivityManager::class)->publish ($ event );
198- $ this ->notifyAboutNewShare ($ user ->getUID (), $ externalShare ->getId (), $ ownerFederatedId , $ sharedByFederatedId , $ name , $ ownerDisplayName );
196+ $ this ->notifyAboutNewShare ($ user ->getUID (), ( string ) $ externalShare ->getId (), $ ownerFederatedId , $ sharedByFederatedId , $ name , $ ownerDisplayName );
199197
200198 // If auto-accept is enabled, accept the share
201199 if ($ this ->federatedShareProvider ->isFederatedTrustedShareAutoAccept () && $ trustedServers ?->isTrustedServer($ remote ) === true ) {
@@ -204,7 +202,7 @@ public function shareReceived(ICloudFederationShare $share): string {
204202 }
205203 }
206204
207- return $ externalShare ->getId ();
205+ return ( string ) $ externalShare ->getId ();
208206 } catch (\Exception $ e ) {
209207 $ this ->logger ->error ('Server can not add remote share. ' , [
210208 'app ' => 'files_sharing ' ,
@@ -466,7 +464,7 @@ private function unshare(string $id, array $notification): array {
466464 $ notification = $ this ->notificationManager ->createNotification ();
467465 $ notification ->setApp ('files_sharing ' )
468466 ->setUser ($ share ->getUser ())
469- ->setObject ('remote_share ' , $ share ->getId ());
467+ ->setObject ('remote_share ' , ( string ) $ share ->getId ());
470468 $ this ->notificationManager ->markProcessed ($ notification );
471469
472470 $ event = $ this ->activityManager ->generateEvent ();
0 commit comments