Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit ef4a9c6

Browse files
committed
Deduplicate feeds by feed URL, not link element.
Previously, we used the RSS <link> to determine if a feed was a duplicate, but it's common for multiple feeds to exist for a single site. This changes the logic to just deduplicate based on the actual link given to us by a user. I also fixed a bug where we checked more than 1 duplicate instead of just checking for any duplicates. See #899 and #883
1 parent 72f58fd commit ef4a9c6

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

plugins/backend/decsync/decsyncInterface.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ public class FeedReader.decsyncInterface : FeedServerInterface {
386386

387387
if(feed != null)
388388
{
389-
if(!db.feed_exists(feed.getURL()))
389+
if(!db.feed_exists(feed.getXmlUrl()))
390390
{
391391
db.write_feeds(ListUtils.single(feed));
392392

plugins/backend/local/localInterface.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public class FeedReader.localInterface : FeedServerInterface {
391391

392392
if(feed != null)
393393
{
394-
if(!db.feed_exists(feed.getURL()))
394+
if(!db.feed_exists(feed.getXmlUrl()))
395395
{
396396
db.write_feeds(ListUtils.single(feed));
397397
return true;

src/DataBaseReadOnly.vala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -677,12 +677,11 @@ public class FeedReader.DataBaseReadOnly : GLib.Object {
677677
return id;
678678
}
679679

680-
public bool feed_exists(string feed_url)
680+
public bool feed_exists(string xml_url)
681681
{
682-
var rows = m_db.execute("SELECT COUNT(*) FROM main.feeds WHERE url = ? LIMIT 1", { feed_url });
682+
var rows = m_db.execute("SELECT COUNT(*) FROM main.feeds WHERE xmlURL = ? LIMIT 1", { xml_url });
683683
assert(rows.size == 1 && rows[0].size == 1);
684-
// FIXME: Why > 1 and not > 0?
685-
return rows[0][0].to_int() > 1;
684+
return rows[0][0].to_int() > 0;
686685
}
687686

688687
public Feed? read_feed(string feedID)

0 commit comments

Comments
 (0)