This commit is contained in:
Bernhard Posselt 2016-10-02 18:05:49 +02:00
Родитель e4e226c394
Коммит 8d63975360
10 изменённых файлов: 10 добавлений и 42 удалений

Просмотреть файл

@ -328,13 +328,6 @@
<unsigned>true</unsigned>
<notnull>false</notnull>
</field>
<field>
<name>updated_date</name>
<type>integer</type>
<length>8</length>
<unsigned>true</unsigned>
<notnull>false</notnull>
</field>
<field>
<name>body</name>
<type>clob</type>

Просмотреть файл

@ -8,7 +8,7 @@
Before you update to a new version, [check the changelog](https://github.com/nextcloud/news/blob/master/CHANGELOG.md) to avoid surprises.
**Important**: To enable feed updates you will need to enable either [Nextcloud system cron](https://docs.nextcloud.com/server/10/admin_manual/configuration_server/background_jobs_configuration.html#cron) or use [an updater](https://github.com/owncloud/news-updater) which uses the built in update API and disable cron updates. More information can be found [in the README](https://github.com/nextcloud/news).]]></description>
<version>9.1.0</version>
<version>9.0.4</version>
<licence>agpl</licence>
<author>Bernhard Posselt</author>
<author>Alessandro Cosentino</author>

Просмотреть файл

@ -30,7 +30,7 @@
},
"require": {
"ezyang/htmlpurifier": "4.7",
"fguillot/picofeed": "0.1.25",
"fguillot/picofeed": "0.1.23",
"pear/net_url2": "2.2",
"riimu/kit-pathjoin": "1.1.2"
}

Просмотреть файл

@ -57,7 +57,6 @@ class Item extends Entity implements IAPI, \JsonSerializable {
protected $title;
protected $author;
protected $pubDate;
protected $updatedDate;
protected $body;
protected $enclosureMime;
protected $enclosureLink;
@ -70,7 +69,6 @@ class Item extends Entity implements IAPI, \JsonSerializable {
public function __construct() {
$this->addType('pubDate', 'integer');
$this->addType('updatedDate', 'integer');
$this->addType('feedId', 'integer');
$this->addType('status', 'integer');
$this->addType('rtl', 'boolean');
@ -124,7 +122,6 @@ class Item extends Entity implements IAPI, \JsonSerializable {
'title' => $this->getTitle(),
'author' => $this->getAuthor(),
'pubDate' => $this->getPubDate(),
'updatedDate' => $this->getUpdatedDate(),
'body' => $this->getBody(),
'enclosureMime' => $this->getEnclosureMime(),
'enclosureLink' => $this->getEnclosureLink(),
@ -147,7 +144,6 @@ class Item extends Entity implements IAPI, \JsonSerializable {
'title' => $this->getTitle(),
'author' => $this->getAuthor(),
'pubDate' => $this->getPubDate(),
'updatedDate' => $this->getUpdatedDate(),
'body' => $this->getBody(),
'enclosureMime' => $this->getEnclosureMime(),
'enclosureLink' => $this->getEnclosureLink(),
@ -168,7 +164,6 @@ class Item extends Entity implements IAPI, \JsonSerializable {
'title' => $this->getTitle(),
'author' => $this->getAuthor(),
'pubDate' => $this->getPubDate(),
'updatedDate' => $this->getUpdatedDate(),
'body' => $this->getBody(),
'enclosureMime' => $this->getEnclosureMime(),
'enclosureLink' => $this->getEnclosureLink(),
@ -191,7 +186,6 @@ class Item extends Entity implements IAPI, \JsonSerializable {
$item->setTitle($import['title']);
$item->setAuthor($import['author']);
$item->setPubDate($import['pubDate']);
$item->setUpdatedDate($import['updatedDate']);
$item->setBody($import['body']);
$item->setEnclosureMime($import['enclosureMime']);
$item->setEnclosureLink($import['enclosureLink']);

Просмотреть файл

@ -240,8 +240,7 @@ class FeedFetcher implements IFeedFetcher {
$item->setUrl($parsedItem->getUrl());
$item->setGuid($parsedItem->getId());
$item->setGuidHash($item->getGuid());
$item->setPubDate($parsedItem->getPublishedDate()->getTimestamp());
$item->setUpdatedDate($parsedItem->getUpdatedDate()->getTimestamp());
$item->setPubDate($parsedItem->getDate()->getTimestamp());
$item->setRtl($this->determineRtl($parsedItem, $parsedFeed));
// unescape content because angularjs helps against XSS

Просмотреть файл

@ -246,7 +246,7 @@ class FeedService extends Service {
// in case of update
if ($forceUpdate ||
$item->getUpdatedDate() > $dbItem->getUpdatedDate()) {
$item->getPubDate() > $dbItem->getPubDate()) {
$dbItem->setTitle($item->getTitle());
$dbItem->setUrl($item->getUrl());
@ -255,7 +255,6 @@ class FeedService extends Service {
$dbItem->setRtl($item->getRtl());
$dbItem->setLastModified($item->getLastModified());
$dbItem->setPubDate($item->getPubDate());
$dbItem->setUpdatedDate($item->getUpdatedDate());
$dbItem->setEnclosureMime($item->getEnclosureMime());
$dbItem->setEnclosureLink($item->getEnclosureLink());
$dbItem->setBody(

Просмотреть файл

@ -119,10 +119,10 @@ class ExportControllerTest extends \PHPUnit_Framework_TestCase {
);
$this->assertEquals('[{"guid":null,"url":null,"title":null,' .
'"author":null,"pubDate":null,"updatedDate":null,"body":null,"enclosureMime":null,' .
'"author":null,"pubDate":null,"body":null,"enclosureMime":null,' .
'"enclosureLink":null,"unread":false,"starred":false,' .
'"feedLink":"http:\/\/goo","rtl":null},{"guid":null,"url":null,' .
'"title":null,"author":null,"pubDate":null,"updatedDate":null,"body":null,' .
'"title":null,"author":null,"pubDate":null,"body":null,' .
'"enclosureMime":null,"enclosureLink":null,"unread":false,' .
'"starred":false,"feedLink":"http:\/\/gee","rtl":null}]',
$return->render());

Просмотреть файл

@ -61,7 +61,6 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
$item->setTitle('title');
$item->setAuthor('author');
$item->setPubDate(123);
$item->setUpdatedDate(234);
$item->setBody('body');
$item->setEnclosureMime('audio/ogg');
$item->setEnclosureLink('enclink');
@ -82,7 +81,6 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
'title' => 'title',
'author' => 'author',
'pubDate' => 123,
'updatedDate' => 234,
'body' => 'body',
'enclosureMime' => 'audio/ogg',
'enclosureLink' => 'enclink',
@ -106,7 +104,6 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
$item->setTitle('title');
$item->setAuthor('author');
$item->setPubDate(123);
$item->setUpdatedDate(234);
$item->setBody('<body><div>this is a test</body>');
$item->setEnclosureMime('audio/ogg');
$item->setEnclosureLink('enclink');
@ -126,7 +123,6 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
'title' => 'title',
'author' => 'author',
'pubDate' => 123,
'updatedDate' => 234,
'body' => '<body><div>this is a test</body>',
'enclosureMime' => 'audio/ogg',
'enclosureLink' => 'enclink',
@ -149,7 +145,6 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
$item->setTitle('title');
$item->setAuthor('author');
$item->setPubDate(123);
$item->setUpdatedDate(234);
$item->setBody('body');
$item->setEnclosureMime('audio/ogg');
$item->setEnclosureLink('enclink');
@ -170,7 +165,6 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
'title' => 'title',
'author' => 'author',
'pubDate' => 123,
'updatedDate' => 234,
'body' => 'body',
'enclosureMime' => 'audio/ogg',
'enclosureLink' => 'enclink',
@ -190,7 +184,6 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
$item->setTitle('title');
$item->setAuthor('author');
$item->setPubDate(123);
$item->setUpdatedDate(234);
$item->setBody('body');
$item->setEnclosureMime('audio/ogg');
$item->setEnclosureLink('enclink');
@ -228,7 +221,6 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
'title' => $item->getTitle(),
'author' => $item->getAuthor(),
'pubDate' => $item->getPubDate(),
'updatedDate' => $item->getUpdatedDate(),
'body' => $item->getBody(),
'enclosureMime' => $item->getEnclosureMime(),
'enclosureLink' => $item->getEnclosureLink(),
@ -252,7 +244,6 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
'title' => $item->getTitle(),
'author' => $item->getAuthor(),
'pubDate' => $item->getPubDate(),
'updatedDate' => $item->getUpdatedDate(),
'body' => $item->getBody(),
'enclosureMime' => $item->getEnclosureMime(),
'enclosureLink' => $item->getEnclosureLink(),

Просмотреть файл

@ -38,7 +38,6 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase {
private $title;
private $guid;
private $pub;
private $updated;
private $body;
private $author;
private $enclosureLink;
@ -111,7 +110,6 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase {
$this->body2 = 'let the bodies hit the floor ' .
'<a target="_blank" href="test">test</a>';
$this->pub = 23111;
$this->updated = 23444;
$this->author = '&lt;boogieman';
$this->enclosureLink = 'http://enclosure.you';
@ -211,15 +209,11 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase {
$item = new Item();
date_default_timezone_set('America/Los_Angeles');
$pubdate = \Datetime::createFromFormat('U',$this->pub);
$this->expectItem('getPublishedDate', $pubdate);
$date = new \DateTime();
$date->setTimestamp($this->pub);
$this->expectItem('getDate', $date);
$item->setPubDate($this->pub);
$update = \Datetime::createFromFormat('U',$this->updated);
$this->expectItem('getUpdatedDate', $update);
$item->setUpdatedDate($this->updated);
$item->setStatus(0);
$item->setUnread();
$item->setUrl($this->permalink);

Просмотреть файл

@ -384,7 +384,6 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase {
$item->setGuidHash(md5('hi'));
$item->setFeedId(3);
$item->setPubDate(2);
$item->setUpdatedDate(2);
$item->setTitle('hey');
$item->setAuthor('aut');
$item->setBody('new');
@ -397,7 +396,6 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase {
$item->setGuidHash(md5('hi'));
$item->setFeedId(3);
$item->setPubDate(1);
$item->setUpdatedDate(1);
$item->setTitle('ho');
$item->setAuthor('auto');
$item->setBody('old');
@ -405,7 +403,7 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase {
return $item;
}
public function testUpdateUpdatesWhenUpdateddateIsNewer() {
public function testUpdateUpdatesWhenPubdateIsNewer() {
$feed = $this->createUpdateFeed();
$item = $this->createUpdateItem();
$item2 = $this->createUpdateItem2();