From e35575e6fd36bc9f9306a10b7db36caf1d831856 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 24 May 2015 19:58:54 -0400 Subject: [PATCH] If last viewed collection is set but not found, default to My Library --- chrome/content/zotero/xpcom/collectionTreeView.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index 5564675de1..4b9bbeb2e1 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -108,9 +108,9 @@ Zotero.CollectionTreeView.prototype.setTree = Zotero.Promise.coroutine(function* var lastViewedID = Zotero.Prefs.get('lastViewedFolder'); if (lastViewedID) { - yield this.selectByID(lastViewedID); + var selected = yield this.selectByID(lastViewedID); } - else { + if (!selected) { this.selection.select(0); } @@ -849,7 +849,7 @@ Zotero.CollectionTreeView.prototype.selectByID = Zotero.Promise.coroutine(functi switch (type) { case 'L': yield this.selectLibrary(id); - return; + return true; case 'C': var found = yield this.expandToCollection(id); @@ -862,11 +862,13 @@ Zotero.CollectionTreeView.prototype.selectByID = Zotero.Promise.coroutine(functi } if (!found) { - return; + return false; } var row = this._rowMap[type + id]; this._treebox.ensureRowIsVisible(row); yield this.selectWait(row); + + return true; });