From c7b15d39a56277aba35ba815a0087bc69084d07c Mon Sep 17 00:00:00 2001 From: roxanariza Date: Fri, 24 May 2024 19:34:53 +0300 Subject: [PATCH] Fix Musora API ContentController array offset on value of type null (#34) --- src/Controllers/ContentController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Controllers/ContentController.php b/src/Controllers/ContentController.php index ab79369b..28bffcc3 100644 --- a/src/Controllers/ContentController.php +++ b/src/Controllers/ContentController.php @@ -232,10 +232,6 @@ public function getContentOptimised($contentId, Request $request, $playlistItemI } $content = $this->contentService->getById($contentId); - - if(($content['type'] == 'pack-bundle' || $content['type'] == 'pack') && (user()?->isEnrolledIntoCohort(\Arr::pluck($content['permissions'], 'permission_id')))){ - ContentRepository::$pullFutureContent = true; - } if (!$content) { $userId = user()?->id; Log::warning("No content with id $contentId exists. (userId:$userId)"); @@ -254,6 +250,11 @@ public function getContentOptimised($contentId, Request $request, $playlistItemI ); } + //Display all cohort lessons(including lessons that haven't been released) on the apps too + if(($content['type'] == 'pack-bundle' || $content['type'] == 'pack') && (user()?->isEnrolledIntoCohort(\Arr::pluck($content['permissions'], 'permission_id')))){ + ContentRepository::$pullFutureContent = true; + } + $decoratorsEnabled = Decorator::$typeDecoratorsEnabled; Decorator::$typeDecoratorsEnabled = false;