mirror of
https://github.com/chylex/Nextcloud-News.git
synced 2025-04-25 11:15:47 +02:00
fix multiple results for guid_hash
Signed-off-by: anoy <anoymouserver+github@mailbox.org>
This commit is contained in:
parent
a74491ecde
commit
1fcab6e6c6
lib
@ -99,6 +99,7 @@ class ItemMapperV2 extends NewsMapperV2
|
||||
/**
|
||||
* Find an item by a GUID hash.
|
||||
*
|
||||
* @param int $feedId ID of the feed
|
||||
* @param string $guidHash hash to find with
|
||||
*
|
||||
* @return Item|Entity
|
||||
@ -106,12 +107,14 @@ class ItemMapperV2 extends NewsMapperV2
|
||||
* @throws DoesNotExistException
|
||||
* @throws MultipleObjectsReturnedException
|
||||
*/
|
||||
public function findByGuidHash(string $guidHash): Item
|
||||
public function findByGuidHash(int $feedId, string $guidHash): Item
|
||||
{
|
||||
$builder = $this->db->getQueryBuilder();
|
||||
$builder->addSelect('*')
|
||||
->from($this->tableName)
|
||||
->andWhere('feed_id = :feed_id')
|
||||
->andWhere('guid_hash = :guid_hash')
|
||||
->setParameter(':feed_id', $feedId, IQueryBuilder::PARAM_INT)
|
||||
->setParameter(':guid_hash', $guidHash, IQueryBuilder::PARAM_STR);
|
||||
|
||||
return $this->findEntity($builder);
|
||||
|
@ -75,7 +75,7 @@ class ItemServiceV2 extends Service
|
||||
public function insertOrUpdate(Item $item)
|
||||
{
|
||||
try {
|
||||
$db_item = $this->mapper->findByGuidHash($item->getGuidHash());
|
||||
$db_item = $this->mapper->findByGuidHash($item->getFeedId(), $item->getGuidHash());
|
||||
|
||||
// Transfer user modifications
|
||||
$item->setUnread($db_item->isUnread())
|
||||
|
Loading…
Reference in New Issue
Block a user