diff --git a/chrome/content/zotero/xpcom/sync/syncRunner.js b/chrome/content/zotero/xpcom/sync/syncRunner.js index e0d3f99ee1..295a158d1a 100644 --- a/chrome/content/zotero/xpcom/sync/syncRunner.js +++ b/chrome/content/zotero/xpcom/sync/syncRunner.js @@ -371,10 +371,8 @@ Zotero.Sync.Runner_Module = function (options = {}) { } let remoteGroupVersions = yield client.getGroupVersions(keyInfo.userID); - Zotero.debug(remoteGroupVersions); let remoteGroupIDs = Object.keys(remoteGroupVersions).map(id => parseInt(id)); let skippedGroups = Zotero.Sync.Data.Local.getSkippedGroups(); - Zotero.debug(skippedGroups); // Remove skipped groups if (syncAllLibraries) { @@ -456,9 +454,9 @@ Zotero.Sync.Runner_Module = function (options = {}) { // // TODO: Localize for (let group of remotelyMissingGroups) { - // Ignore archived groups + // Ignore remotely missing archived groups if (group.archived) { - groupsToDownload.splice(groupsToDownload.indexOf(group.id), 1); + groupsToDownload = groupsToDownload.filter(groupID => groupID != group.id); continue; } diff --git a/test/tests/syncRunnerTest.js b/test/tests/syncRunnerTest.js index 24e73df3d6..1e9713addf 100644 --- a/test/tests/syncRunnerTest.js +++ b/test/tests/syncRunnerTest.js @@ -296,12 +296,12 @@ describe("Zotero.Sync.Runner", function () { }); it("should filter out remotely missing archived libraries if library list not provided", function* () { - var syncedGroupID = responses.groups.ownerGroup.json.id; + var ownerGroupID = responses.groups.ownerGroup.json.id; var archivedGroupID = 162512451; // nonexistent group id - var syncedGroup = yield createGroup({ - id: syncedGroupID, - version: responses.groups.ownerGroup.json.version - 1 + var ownerGroup = yield createGroup({ + id: ownerGroupID, + version: responses.groups.ownerGroup.json.version }); var archivedGroup = yield createGroup({ id: archivedGroupID, @@ -310,15 +310,23 @@ describe("Zotero.Sync.Runner", function () { }); setResponse('userGroups.groupVersions'); - setResponse('groups.ownerGroup'); + setResponse('groups.memberGroup'); var libraries = yield runner.checkLibraries( runner.getAPIClient({ apiKey }), false, responses.keyInfo.fullAccess.json ); - assert.lengthOf(libraries, 2); - assert.sameMembers(libraries, [userLibraryID, syncedGroup.libraryID]); + assert.lengthOf(libraries, 3); + assert.sameMembers( + libraries, + [ + userLibraryID, + ownerGroup.libraryID, + // Nonexistent group should've been created + Zotero.Groups.getLibraryIDFromGroupID(responses.groups.memberGroup.json.id) + ] + ); }); it("should unarchive library if available remotely", function* () {