Skip to content

Commit

Permalink
Never auto-select new groups, since they always come from syncs
Browse files Browse the repository at this point in the history
Fixes test failure from 2e74cd7
  • Loading branch information
dstillman committed Jun 16, 2017
1 parent 2e74cd7 commit 859c506
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
7 changes: 6 additions & 1 deletion chrome/content/zotero/xpcom/collectionTreeView.js
Expand Up @@ -490,7 +490,12 @@ Zotero.CollectionTreeView.prototype.notify = Zotero.Promise.coroutine(function*
+ "together in collectionTreeView::notify()")
}
yield this.reload();
yield this.selectByID(selectRow ? "L" + id : currentTreeRow.id);
yield this.selectByID(
// Groups only come from sync, so they should never be auto-selected
(type != 'group' && selectRow)
? "L" + id
: currentTreeRow.id
);
break;
}
}
Expand Down
4 changes: 1 addition & 3 deletions chrome/content/zotero/xpcom/sync/syncRunner.js
Expand Up @@ -527,9 +527,7 @@ Zotero.Sync.Runner_Module = function (options = {}) {
group.version = info.version;
group.archived = false;
group.fromJSON(info.data, Zotero.Users.getCurrentUserID());
yield group.saveTx({
skipSelect: true
});
yield group.saveTx();

// Add group to library list
libraries.push(group.libraryID);
Expand Down
2 changes: 1 addition & 1 deletion test/content/support.js
Expand Up @@ -354,7 +354,7 @@ var createFeed = Zotero.Promise.coroutine(function* (props = {}) {
feed.refreshInterval = props.refreshInterval || 12;
feed.cleanupReadAfter = props.cleanupReadAfter || 2;
feed.cleanupUnreadAfter = props.cleanupUnreadAfter || 30;
yield feed.saveTx();
yield feed.saveTx(props.saveOptions);
return feed;
});

Expand Down
14 changes: 12 additions & 2 deletions test/tests/collectionTreeViewTest.js
Expand Up @@ -451,9 +451,19 @@ describe("Zotero.CollectionTreeView", function() {

it("should select a new feed", function* () {
var feed = yield createFeed();
// Library should still be selected
// Feed should be selected
assert.equal(cv.getSelectedLibraryID(), feed.id);
})
});

it("shouldn't select a new feed with skipSelect: true", function* () {
var feed = yield createFeed({
saveOptions: {
skipSelect: true
}
});
// Library should still be selected
assert.equal(cv.getSelectedLibraryID(), userLibraryID);
});

it("should remove deleted feed", function* () {
var feed = yield createFeed();
Expand Down

0 comments on commit 859c506

Please sign in to comment.