commit 21c040880005df04064200d80040d613babcd91b
parent beb74a4504d14283c120e060b7f2da5c9d1555c9
Author: Dan Stillman <dstillman@zotero.org>
Date: Sun, 18 Nov 2012 22:39:08 -0500
Resend tags requested by server to fix tag issue for some libraries
Diffstat:
1 file changed, 36 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js
@@ -2619,6 +2619,42 @@ Zotero.Sync.Server.Data = new function() {
if (_timeToYield()) yield true;
+
+ // TEMP: Resend tags requested by server
+ try {
+ if (xml.fixtags.length()) {
+ for each(var tagsNode in xml.fixtags.tags) {
+ var libraryID = _libID(tagsNode.@libraryID);
+ if (libraryID && !Zotero.Libraries.isEditable(libraryID)) {
+ continue;
+ }
+ var tagsKeys = tagsNode.toString().split(' ');
+ for each(var key in tagsKeys) {
+ var sql = "SELECT tagID FROM tags WHERE libraryID=? AND key=?";
+ var tagID = Zotero.DB.valueQuery(sql, [libraryID, key]);
+
+ var sql = "SELECT COUNT(*) FROM itemTags WHERE tagID=?";
+ if (Zotero.DB.valueQuery(sql, [tagID])) {
+ var sql = "UPDATE tags SET clientDateModified=CURRENT_TIMESTAMP "
+ + "WHERE tagID=?";
+ Zotero.DB.query(sql, [tagID]);
+ syncSession.addToUpdated({
+ objectType: 'tag',
+ libraryID: libraryID,
+ key: key
+ });
+ }
+ }
+ }
+ }
+ }
+ catch (e) {
+ Components.utils.reportError(e);
+ Zotero.debug(e);
+ }
+ if (_timeToYield()) yield true;
+
+
// Get unmodified creators embedded within items -- this is necessary if, say,
// a creator was deleted locally and appears in a new/modified item remotely
var embeddedCreators = {};