From 380eb8ad828e99209dd40473b9d78037ee0917f9 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Thu, 24 Mar 2016 13:52:19 +0100 Subject: [PATCH] Bug 1241810 - Follow-up: Fix FeedSubscription.hasBeenUpdated() after conflicts. r=me MozReview-Commit-ID: LL7t96m1u6s --- .../gecko/feeds/subscriptions/FeedSubscription.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/feeds/subscriptions/FeedSubscription.java b/mobile/android/base/java/org/mozilla/gecko/feeds/subscriptions/FeedSubscription.java index 0e2c3fa01751..7ce7f193fd47 100644 --- a/mobile/android/base/java/org/mozilla/gecko/feeds/subscriptions/FeedSubscription.java +++ b/mobile/android/base/java/org/mozilla/gecko/feeds/subscriptions/FeedSubscription.java @@ -75,23 +75,22 @@ public class FeedSubscription { * Guesstimate if this response is a newer representation of the feed. */ public boolean hasBeenUpdated(FeedFetcher.FeedResponse response) { - final Item otherItem = response.feed.getLastItem(); - final Item lastItem = response.feed.getLastItem(); + final Item responseItem = response.feed.getLastItem(); - if (lastItem.getTimestamp() > otherItem.getTimestamp()) { + if (responseItem.getTimestamp() > lastItemTimestamp) { // The timestamp is from a newer date so we expect that this item is a new item. But this // could also mean that the timestamp of an already existing item has been updated. We // accept that and assume that the content will have changed too in this case. return true; } - if (lastItem.getTimestamp() == otherItem.getTimestamp() && lastItem.getTimestamp() != 0) { + if (responseItem.getTimestamp() == lastItemTimestamp && responseItem.getTimestamp() != 0) { // We have a timestamp that is not zero and this item has still the timestamp: It's very // likely that we are looking at the same item. We assume this is not new content. return false; } - if (!lastItem.getURL().equals(otherItem.getURL())) { + if (!responseItem.getURL().equals(lastItemUrl)) { // The URL changed: It is very likely that this is a new item. At least it has been updated // in a way that we just treat it as new content here. return true;