From d42a20506ba07ec72d2d618db095ec853e51f9c1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 5 Apr 2017 14:44:18 +0200 Subject: Fallback when GUID is empty https://github.com/FreshRSS/FreshRSS/issues/1482 --- app/Models/Entry.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/Models/Entry.php') diff --git a/app/Models/Entry.php b/app/Models/Entry.php index a562a963a..2946e839d 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -22,7 +22,6 @@ class FreshRSS_Entry extends Minz_Model { public function __construct($feed = '', $guid = '', $title = '', $author = '', $content = '', $link = '', $pubdate = 0, $is_read = false, $is_favorite = false, $tags = '') { - $this->_guid($guid); $this->_title($title); $this->_author($author); $this->_content($content); @@ -32,6 +31,7 @@ class FreshRSS_Entry extends Minz_Model { $this->_isFavorite($is_favorite); $this->_feed($feed); $this->_tags(preg_split('/[\s#]/', $tags)); + $this->_guid($guid); } public function id() { @@ -101,6 +101,12 @@ class FreshRSS_Entry extends Minz_Model { $this->id = $value; } public function _guid($value) { + if ($value == '') { + $value = $this->title; + if ($value == '') { + $value = $this->hash(); + } + } $this->guid = $value; } public function _title($value) { -- cgit v1.2.3 From dadd6e7beed41b7a7f3473fda60f7fcb57a9f866 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 5 Apr 2017 14:50:16 +0200 Subject: Use link instead of title fallback --- app/Models/Entry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/Models/Entry.php') diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 2946e839d..26cd24797 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -102,7 +102,7 @@ class FreshRSS_Entry extends Minz_Model { } public function _guid($value) { if ($value == '') { - $value = $this->title; + $value = $this->link; if ($value == '') { $value = $this->hash(); } -- cgit v1.2.3