fixed: dont sync instagram posts without captions
continuous-integration/drone/push Build is failing Details

This commit is contained in:
philipp lang 2022-08-15 22:02:55 +02:00
parent 20015d312b
commit 918b444cb9
2 changed files with 6 additions and 2 deletions

View File

@ -90,8 +90,12 @@ class InstagramService extends SocialService {
$posts = json_decode((string) $response->getBody(), true)['data']; $posts = json_decode((string) $response->getBody(), true)['data'];
foreach ($posts as $post) { foreach ($posts as $post) {
if (!data_get($post, 'caption')) {
continue;
}
yield [ yield [
'message' => $post['caption'], 'message' => data_get($post, 'caption', ''),
'remote_id' => $post['id'], 'remote_id' => $post['id'],
'href' => $post['permalink'], 'href' => $post['permalink'],
'created_at' => Carbon::parse($post['timestamp']), 'created_at' => Carbon::parse($post['timestamp']),

View File

@ -64,7 +64,7 @@ class InstagramLogin extends FormWidgetBase
{ {
$me = app(InstagramService::class)->me($accessToken); $me = app(InstagramService::class)->me($accessToken);
Page::create([ Page::updateOrCreate(['remote_id' => $me['id']], [
'access_token' => $accessToken, 'access_token' => $accessToken,
'type' => app(InstagramService::class)->getType(), 'type' => app(InstagramService::class)->getType(),
'name' => $me['username'], 'name' => $me['username'],