www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 47e9f82927e89de5a68c523212f443342e439076
parent 1855b5e1f9a8e6b31e96c57a24dd1398dcf4dffe
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat,  6 Feb 2016 03:25:28 -0500

Avoid repeated file existence checks for some files in getImageSrc()

Diffstat:
Mchrome/content/zotero/xpcom/data/item.js | 3+++
Mchrome/content/zotero/xpcom/itemTreeView.js | 12++++++------
2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js @@ -2081,6 +2081,7 @@ Zotero.Item.prototype.getFilePathAsync = Zotero.Promise.coroutine(function* () { // Ignore .zotero* files that were relinked before we started blocking them if (path.startsWith(".zotero")) { Zotero.debug("Ignoring attachment file " + path, 2); + this._updateAttachmentStates(false); return false; } @@ -2111,6 +2112,8 @@ Zotero.Item.prototype.getFilePathAsync = Zotero.Promise.coroutine(function* () { this._updateAttachmentStates(false); return false; } + + this._updateAttachmentStates(true); return path; } diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js @@ -1037,8 +1037,6 @@ Zotero.ItemTreeView.prototype.getCellText = function (row, column) Zotero.ItemTreeView.prototype.getImageSrc = function(row, col) { - var self = this; - if(col.id == 'zotero-items-column-title') { // Get item type icon and tag swatches @@ -1086,8 +1084,8 @@ Zotero.ItemTreeView.prototype.getImageSrc = function(row, col) item.getBestAttachmentState() // Refresh cell when promise is fulfilled .then(function (state) { - self._treebox.invalidateCell(row, col); - }) + this._treebox.invalidateCell(row, col); + }.bind(this)) .done(); } } @@ -1103,10 +1101,12 @@ Zotero.ItemTreeView.prototype.getImageSrc = function(row, col) item.fileExists() // Refresh cell when promise is fulfilled .then(function (exists) { - self._treebox.invalidateCell(row, col); - }); + this._treebox.invalidateCell(row, col); + }.bind(this)); } } + + return ""; } Zotero.ItemTreeView.prototype.isContainer = function(row)