From 238183a3fa14bda0de8249a23460754f5f908465 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 6 Jul 2015 04:38:13 -0400 Subject: [PATCH] Fix collapse library ("-") for collections Broken in f5ce2d238e --- chrome/content/zotero/xpcom/collectionTreeView.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index b844479341..3d0c853645 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -653,7 +653,12 @@ Zotero.CollectionTreeView.prototype.collapseLibrary = function(self) { var found = false; for (var i=self.rowCount-1; i>=0; i--) { - if (self._getItemAtRow(i).ref.libraryID !== selectedLibraryID) { + let rowLibraryID = self._getItemAtRow(i).ref.libraryID; + // TEMP: Remove in 5.0 when we can just compare libraryIDs without worrying about null + if (rowLibraryID === 0) { + rowLibraryID = null; + } + if (rowLibraryID !== selectedLibraryID) { // Once we've moved beyond the original library, stop looking if (found) { break; @@ -1013,9 +1018,7 @@ Zotero.CollectionTreeView.prototype._expandRow = function (row, forceOpen) { // Unfiled items if (showUnfiled) { var s = new Zotero.Search; - if (isGroup) { - s.libraryID = libraryID; - } + s.libraryID = intLibraryID; s.name = Zotero.getString('pane.collections.unfiled'); s.addCondition('libraryID', 'is', libraryID); s.addCondition('unfiled', 'true');