зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1241810 - Follow-up: Fix FeedSubscription.hasBeenUpdated() after conflicts. r=me
MozReview-Commit-ID: LL7t96m1u6s
This commit is contained in:
Родитель
efd2f7dfa3
Коммит
380eb8ad82
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче