Fix import labels (#2225)

All labelled articles were wrongly marked as starred.
pull/2226/head
Alexandre Alapetite 6 years ago committed by GitHub
parent da4a80b88a
commit f0684d7018
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      app/Controllers/importExportController.php

@ -41,7 +41,8 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
$list_files = array( $list_files = array(
'opml' => array(), 'opml' => array(),
'json_starred' => array(), 'json_starred' => array(),
'json_feed' => array() 'json_feed' => array(),
'ttrss_starred' => array(),
); );
// We try to list all files according to their type // We try to list all files according to their type
@ -505,7 +506,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
$feed_id = $article_to_feed[$item['id']]; $feed_id = $article_to_feed[$item['id']];
$author = isset($item['author']) ? $item['author'] : ''; $author = isset($item['author']) ? $item['author'] : '';
$is_starred = $starred; $is_starred = false;
$tags = $item['categories']; $tags = $item['categories'];
$labels = array(); $labels = array();
for ($i = count($tags) - 1; $i >= 0; $i --) { for ($i = count($tags) - 1; $i >= 0; $i --) {
@ -522,6 +523,10 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
unset($tags[$i]); unset($tags[$i]);
} }
} }
if ($starred && !$is_starred) {
//If the article has no label, mark it as starred (old format)
$is_starred = empty($labels);
}
$url = $item['alternate'][0]['href']; $url = $item['alternate'][0]['href'];
if (!empty($item['content']['content'])) { if (!empty($item['content']['content'])) {

Loading…
Cancel
Save