Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jangernert/FeedReader.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Long <self@brendanlong.com>2019-05-24 21:21:58 +0300
committerBrendan Long <self@brendanlong.com>2019-05-24 21:45:14 +0300
commitef4a9c618c287af7ea87f6eba14a9e0b2cedc7ee (patch)
tree267ea8dd30fb077f243fcfaae52f1f831bcde298
parent72f58fd4dff45f1eb00bcb36aa69e06644d826ab (diff)
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
-rw-r--r--plugins/backend/decsync/decsyncInterface.vala2
-rw-r--r--plugins/backend/local/localInterface.vala2
-rw-r--r--src/DataBaseReadOnly.vala7
3 files changed, 5 insertions, 6 deletions
diff --git a/plugins/backend/decsync/decsyncInterface.vala b/plugins/backend/decsync/decsyncInterface.vala
index 591bcb97..fa1650d6 100644
--- a/plugins/backend/decsync/decsyncInterface.vala
+++ b/plugins/backend/decsync/decsyncInterface.vala
@@ -386,7 +386,7 @@ public class FeedReader.decsyncInterface : FeedServerInterface {
if(feed != null)
{
- if(!db.feed_exists(feed.getURL()))
+ if(!db.feed_exists(feed.getXmlUrl()))
{
db.write_feeds(ListUtils.single(feed));
diff --git a/plugins/backend/local/localInterface.vala b/plugins/backend/local/localInterface.vala
index 46b9ed96..8961f91f 100644
--- a/plugins/backend/local/localInterface.vala
+++ b/plugins/backend/local/localInterface.vala
@@ -391,7 +391,7 @@ public class FeedReader.localInterface : FeedServerInterface {
if(feed != null)
{
- if(!db.feed_exists(feed.getURL()))
+ if(!db.feed_exists(feed.getXmlUrl()))
{
db.write_feeds(ListUtils.single(feed));
return true;
diff --git a/src/DataBaseReadOnly.vala b/src/DataBaseReadOnly.vala
index 58106e81..da2c54b8 100644
--- a/src/DataBaseReadOnly.vala
+++ b/src/DataBaseReadOnly.vala
@@ -677,12 +677,11 @@ public class FeedReader.DataBaseReadOnly : GLib.Object {
return id;
}
- public bool feed_exists(string feed_url)
+ public bool feed_exists(string xml_url)
{
- var rows = m_db.execute("SELECT COUNT(*) FROM main.feeds WHERE url = ? LIMIT 1", { feed_url });
+ var rows = m_db.execute("SELECT COUNT(*) FROM main.feeds WHERE xmlURL = ? LIMIT 1", { xml_url });
assert(rows.size == 1 && rows[0].size == 1);
- // FIXME: Why > 1 and not > 0?
- return rows[0][0].to_int() > 1;
+ return rows[0][0].to_int() > 0;
}
public Feed? read_feed(string feedID)