fixed: dont sync instagram posts without captions
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
20015d312b
commit
918b444cb9
|
@ -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']),
|
||||||
|
|
|
@ -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'],
|
||||||
|
|
Loading…
Reference in New Issue