1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-04-09 10:15:44 +02:00

also consider enclosure for fingerprint

This commit is contained in:
Bernhard Posselt 2015-11-25 19:04:05 +01:00
parent 52b701c8d4
commit 052178a79f
3 changed files with 9 additions and 3 deletions

View File

@ -221,7 +221,8 @@ class Item extends Entity implements IAPI, \JsonSerializable {
}
private function computeFingerprint() {
return md5($this->getTitle() . $this->getUrl() . $this->getBody());
return md5($this->getTitle() . $this->getUrl() . $this->getBody() .
$this->getEnclosureLink());
}
public function setUrl($url) {

View File

@ -293,13 +293,17 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
$title = 'a';
$body = 'b';
$url = 'http://google.com';
$link = 'ho';
$item = new Item();
$item->setBody($body);
$item->setTitle($title);
$item->setUrl($url);
$item->setEnclosureLink($link);
$item->generateSearchIndex();
$this->assertEquals(md5($title . $url . $body), $item->getFingerprint());
$this->assertEquals(md5($title . $url . $body . $link),
$item->getFingerprint());
}
}

View File

@ -222,7 +222,6 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase {
$item->setGuidHash($this->guid);
$item->setBody($this->body);
$item->setLastModified($this->time);
$item->generateSearchIndex();
$item->setRtl(false);
$this->expectItem('getAuthor', $this->author);
@ -235,6 +234,8 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase {
$item->setEnclosureMime($enclosureType);
$item->setEnclosureLink($this->enclosureLink);
}
$item->generateSearchIndex();
return $item;
}