4
0
Эх сурвалжийг харах

Allow multiple authors (#1997)

Fix https://github.com/FreshRSS/FreshRSS/issues/1968
Alexandre Alapetite 7 жил өмнө
parent
commit
14e1b23e42

+ 9 - 2
app/Models/Feed.php

@@ -341,7 +341,7 @@ class FreshRSS_Feed extends Minz_Model {
 
 
 		foreach ($feed->get_items() as $item) {
 		foreach ($feed->get_items() as $item) {
 			$title = html_only_entity_decode(strip_tags($item->get_title()));
 			$title = html_only_entity_decode(strip_tags($item->get_title()));
-			$author = $item->get_author();
+			$authors = $item->get_authors();
 			$link = $item->get_permalink();
 			$link = $item->get_permalink();
 			$date = @strtotime($item->get_date());
 			$date = @strtotime($item->get_date());
 
 
@@ -409,12 +409,19 @@ class FreshRSS_Feed extends Minz_Model {
 			$guid = $item->get_id(false, false);
 			$guid = $item->get_id(false, false);
 			$hasUniqueGuids &= empty($guids['_' . $guid]);
 			$hasUniqueGuids &= empty($guids['_' . $guid]);
 			$guids['_' . $guid] = true;
 			$guids['_' . $guid] = true;
+			$author_names = '';
+			if (is_array($authors)) {
+				foreach ($authors as $author) {
+					$author_names .= html_only_entity_decode(strip_tags($author->name == '' ? $author->email : $author->name)) . ', ';
+				}
+			}
+			$author_names = substr($author_names, 0, -2);
 
 
 			$entry = new FreshRSS_Entry(
 			$entry = new FreshRSS_Entry(
 				$this->id(),
 				$this->id(),
 				$guid,
 				$guid,
 				$title === null ? '' : $title,
 				$title === null ? '' : $title,
-				$author === null ? '' : html_only_entity_decode(strip_tags($author->name == null ? $author->email : $author->name)),
+				$author_names,
 				$content === null ? '' : $content,
 				$content === null ? '' : $content,
 				$link === null ? '' : $link,
 				$link === null ? '' : $link,
 				$date ? $date : time()
 				$date ? $date : time()