2727use OCP \Files \Node ;
2828use OCP \Files \NotFoundException as FilesNotFoundException ;
2929use OCP \Files \NotPermittedException as FilesNotPermittedException ;
30- use OCP \IConfig ;
3130use OCP \IUserManager ;
3231use OCP \Lock \LockedException ;
3332use OCP \Server ;
@@ -48,7 +47,6 @@ public function __construct(
4847 private readonly CollectiveServiceBase $ collectiveService ,
4948 private readonly UserFolderHelper $ userFolderHelper ,
5049 private readonly IUserManager $ userManager ,
51- private readonly IConfig $ config ,
5250 ContainerInterface $ container ,
5351 private readonly SessionService $ sessionService ,
5452 private readonly SluggerInterface $ slugger ,
@@ -144,7 +142,7 @@ public function getFolder(int $collectiveId, int $fileId, string $userId): Folde
144142 */
145143 public function isPageInPageFolder (int $ collectiveId , int $ parentId , int $ pageId , string $ userId ): void {
146144 $ folder = $ this ->getFolder ($ collectiveId , $ parentId , $ userId );
147- if (! isset ( $ folder ->getById ($ pageId )[ 0 ]) ) {
145+ if ($ folder ->getFirstNodeById ($ pageId ) === null ) {
148146 throw new NotFoundException ('Page ' . $ pageId . ' is not a child of ' . $ parentId );
149147 }
150148 }
@@ -636,9 +634,8 @@ public function findByFileId(int $collectiveId, int $fileId, string $userId, ?in
636634 $ collectiveFolder = $ parentId
637635 ? $ this ->getFolder ($ collectiveId , $ parentId , $ userId )
638636 : $ this ->getCollectiveFolder ($ collectiveId , $ userId );
639- $ pageFile = $ collectiveFolder ->getById ($ fileId );
640- if (isset ($ pageFile [0 ]) && $ pageFile [0 ] instanceof File) {
641- $ pageFile = $ pageFile [0 ];
637+ $ pageFile = $ collectiveFolder ->getFirstNodeById ($ fileId );
638+ if ($ pageFile instanceof File) {
642639 return $ this ->findByFile ($ collectiveId , $ pageFile , $ userId );
643640 }
644641 throw new NotFoundException ('Failed to get page by file ID ' . $ fileId . ' in collective ' . $ collectiveId );
0 commit comments