If last viewed collection is set but not found, default to My Library

This commit is contained in:
Dan Stillman 2015-05-24 19:58:54 -04:00
parent 2ed04eca26
commit e35575e6fd

View file

@ -108,9 +108,9 @@ Zotero.CollectionTreeView.prototype.setTree = Zotero.Promise.coroutine(function*
var lastViewedID = Zotero.Prefs.get('lastViewedFolder'); var lastViewedID = Zotero.Prefs.get('lastViewedFolder');
if (lastViewedID) { if (lastViewedID) {
yield this.selectByID(lastViewedID); var selected = yield this.selectByID(lastViewedID);
} }
else { if (!selected) {
this.selection.select(0); this.selection.select(0);
} }
@ -849,7 +849,7 @@ Zotero.CollectionTreeView.prototype.selectByID = Zotero.Promise.coroutine(functi
switch (type) { switch (type) {
case 'L': case 'L':
yield this.selectLibrary(id); yield this.selectLibrary(id);
return; return true;
case 'C': case 'C':
var found = yield this.expandToCollection(id); var found = yield this.expandToCollection(id);
@ -862,11 +862,13 @@ Zotero.CollectionTreeView.prototype.selectByID = Zotero.Promise.coroutine(functi
} }
if (!found) { if (!found) {
return; return false;
} }
var row = this._rowMap[type + id]; var row = this._rowMap[type + id];
this._treebox.ensureRowIsVisible(row); this._treebox.ensureRowIsVisible(row);
yield this.selectWait(row); yield this.selectWait(row);
return true;
}); });