A free, self-hostable news aggregator…
Empty title guid or first words (#6240)
maThfec9e53d0ebc
diff --git a/app/Models/Entry.php b/app/Models/Entry.phpindex 3caa1ddb9..956134c78 100644--- a/app/Models/Entry.php+++ b/app/Models/Entry.php@@ -117,7 +117,27 @@ class FreshRSS_Entry extends Minz_Model {return $this->guid;}public function title(): string {- return $this->title == '' ? $this->guid() : $this->title;+ $title = '';++ if ($this->title === '') {+ // used while fetching the article from feed and store it in the database+ $title = $this->guid();+ } else {+ // used while fetching from the database+ if ($this->title !== $this->guid) {+ $title = $this->title;+ } else {+ $content = trim(strip_tags($this->content(false)));+ $title = trim(mb_substr($content, 0, MAX_CHARS_EMPTY_FEED_TITLE, 'UTF-8'));++ if ($title === '') {+ $title = $this->guid();+ } elseif (strlen($content) > strlen($title)) {+ $title .= '…';+ }+ }+ }+ return $title;}/** @deprecated */public function author(): string {diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtmlindex 17fdbe7c3..e475b220c 100644--- a/app/views/configure/reading.phtml+++ b/app/views/configure/reading.phtml@@ -124,6 +124,7 @@</select></div></div>+<div class="form-group"><label class="group-name" for="show_author_date"><?= _t('conf.reading.article.authors_date') ?></label><div class="group-controls">diff --git a/constants.php b/constants.phpindex 0bd17377b..59e588311 100644--- a/constants.php+++ b/constants.php@@ -40,6 +40,9 @@ defined('COPY_SYSLOG_TO_STDERR') or define('COPY_SYSLOG_TO_STDERR', filter_var(g// Maximum log file size in Bytes, before it will be divided by twodefined('MAX_LOG_SIZE') or define('MAX_LOG_SIZE', 1048576);+// Amount of characters of text shown if feed has no title+defined('MAX_CHARS_EMPTY_FEED_TITLE') or define('MAX_CHARS_EMPTY_FEED_TITLE', 75);+//This directory must be writable$dataPath = getenv('DATA_PATH');if (is_string($dataPath) && $dataPath !== '') {