Skip to content

Commit 1f4a43d

Browse files
committed
no error when message is share
1 parent e060b36 commit 1f4a43d

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ For now there is no way to make it fully automatic. Thanks to Facebook.
112112
Changelog
113113
---------
114114

115+
1.0.6
116+
- Handle problem when post is share of another post
117+
115118
1.0.5
116119
- Support Package Auto-Discovery
117120

@@ -139,4 +142,4 @@ Roadmap
139142
Credits
140143
-------
141144

142-
This package is developed by [HighSolutions](http://highsolutions.pl), software house from Poland in love in Laravel.
145+
This package is developed by [HighSolutions](https://highsolutions.org), software house from Poland in love in Laravel.

src/Models/FacebookPost.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ protected static function isOldPost($lastPublishedDate, $row)
2020
{
2121
return $lastPublishedDate !== null && $lastPublishedDate >= static::parseDate($row->created_time);
2222
}
23+
24+
protected static function isWrongPost($row)
25+
{
26+
return !isset($row->message);
27+
}
2328

2429
protected static function parseDate($date)
2530
{
@@ -29,7 +34,7 @@ protected static function parseDate($date)
2934
}
3035

3136
protected static function createNew($page, $row)
32-
{
37+
{
3338
return static::create([
3439
'social' => static::$social,
3540
'address' => $page,

src/Models/PostTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static function createNewPosts($page, $data)
1111
$lastPublishedDate = static::getLastPublishedDate($page);
1212

1313
foreach($data as $row) {
14-
if(static::isOldPost($lastPublishedDate, $row))
14+
if(static::isOldPost($lastPublishedDate, $row) || static::isWrongPost($row))
1515
continue;
1616

1717
$new []= static::createNew($page, $row);

0 commit comments

Comments
 (0)