From 0dacadebb92121165ef5b0533e08f0d6b4a47cd6 Mon Sep 17 00:00:00 2001 From: Felix Gradinaru Date: Mon, 16 Oct 2023 21:55:29 +0200 Subject: [PATCH] TASK: Remove restriction to image posts as contemporary Instagram content can also be albums and reels, so we will try thumbnail_url first and then media_url --- Classes/CodeQ/Instagram/Domain/Service/InstagramService.php | 2 +- Resources/Private/Fusion/Image.fusion | 2 +- Resources/Private/Fusion/ImagesList.fusion | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Classes/CodeQ/Instagram/Domain/Service/InstagramService.php b/Classes/CodeQ/Instagram/Domain/Service/InstagramService.php index bd57341..0b441d4 100644 --- a/Classes/CodeQ/Instagram/Domain/Service/InstagramService.php +++ b/Classes/CodeQ/Instagram/Domain/Service/InstagramService.php @@ -46,7 +46,7 @@ public function getFeed() $token = $this->getToken()['token']; $apiData = [ - 'fields' => 'id,caption,permalink,media_type,media_url,timestamp', + 'fields' => 'id,caption,permalink,media_type,media_url,thumbnail_url,timestamp', 'access_token' => $token ]; diff --git a/Resources/Private/Fusion/Image.fusion b/Resources/Private/Fusion/Image.fusion index 1022012..8b405d6 100644 --- a/Resources/Private/Fusion/Image.fusion +++ b/Resources/Private/Fusion/Image.fusion @@ -5,7 +5,7 @@ prototype(CodeQ.Instagram:Image) < prototype(Neos.Fusion:Component) { renderer = afx`
  • - {props.item.caption} + {props.item.caption}
  • ` diff --git a/Resources/Private/Fusion/ImagesList.fusion b/Resources/Private/Fusion/ImagesList.fusion index f0b159d..f375d19 100644 --- a/Resources/Private/Fusion/ImagesList.fusion +++ b/Resources/Private/Fusion/ImagesList.fusion @@ -1,9 +1,9 @@ prototype(CodeQ.Instagram:ImagesList) < prototype(Neos.Fusion:Component) { limit = 6 # currently get images returns up to 24 items as first page - # but since not all feed items are images, you might get less and should consider getting - # a second page when you need more then ~10 images. - collection = ${Array.filter(Instagram.getFeed(), item => item.media_type == 'IMAGE')} + # but since not all feed items have a media_url or a thumbnail_url + # consider getting a second page when you need more then ~10 images. + collection = ${Array.filter(Instagram.getFeed(), item => item.thumbnail_url || item.media_url)} attributes = Neos.Fusion:Attributes renderer = afx`