commit c83d64ad0d90599e8c235c98b09b0d62dc534aa8
parent d39957fa56615c15fee15c8e77cf46a70a03984f
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 5 May 2010 18:07:01 +0000
Fix constant syncing due to future-dated items
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/chrome/content/zotero/xpcom/data/dataObjects.js b/chrome/content/zotero/xpcom/data/dataObjects.js
@@ -147,7 +147,7 @@ Zotero.DataObjects = function (object, objectPlural, id, table) {
}
- this.getNewer = function (date) {
+ this.getNewer = function (date, ignoreFutureDates) {
if (date && date.constructor.name != 'Date') {
throw ("date must be a JS Date in "
+ "Zotero." + this._ZDO_Objects + ".getNewer()")
@@ -156,6 +156,9 @@ Zotero.DataObjects = function (object, objectPlural, id, table) {
var sql = "SELECT ROWID FROM " + this._ZDO_table;
if (date) {
sql += " WHERE clientDateModified>?";
+ if (ignoreFutureDates) {
+ sql += " AND clientDateModified<=CURRENT_TIMESTAMP";
+ }
return Zotero.DB.columnQuery(sql, Zotero.Date.dateToSQL(date, true));
}
return Zotero.DB.columnQuery(sql);
diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js
@@ -1532,7 +1532,7 @@ Zotero.Sync.Server = new function () {
// Check if any items were modified during /upload,
// and restart the sync if so
- if (Zotero.Items.getNewer(nextLocalSyncDate)) {
+ if (Zotero.Items.getNewer(nextLocalSyncDate, true)) {
Zotero.debug("Items were modified during upload -- restarting sync");
Zotero.Sync.Server.sync(_callbacks, true, true);
return;