Avoid repeated file existence checks for some files in getImageSrc()
This commit is contained in:
parent
1855b5e1f9
commit
47e9f82927
|
@ -2081,6 +2081,7 @@ Zotero.Item.prototype.getFilePathAsync = Zotero.Promise.coroutine(function* () {
|
||||||
// Ignore .zotero* files that were relinked before we started blocking them
|
// Ignore .zotero* files that were relinked before we started blocking them
|
||||||
if (path.startsWith(".zotero")) {
|
if (path.startsWith(".zotero")) {
|
||||||
Zotero.debug("Ignoring attachment file " + path, 2);
|
Zotero.debug("Ignoring attachment file " + path, 2);
|
||||||
|
this._updateAttachmentStates(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2111,6 +2112,8 @@ Zotero.Item.prototype.getFilePathAsync = Zotero.Promise.coroutine(function* () {
|
||||||
this._updateAttachmentStates(false);
|
this._updateAttachmentStates(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._updateAttachmentStates(true);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1037,8 +1037,6 @@ Zotero.ItemTreeView.prototype.getCellText = function (row, column)
|
||||||
|
|
||||||
Zotero.ItemTreeView.prototype.getImageSrc = function(row, col)
|
Zotero.ItemTreeView.prototype.getImageSrc = function(row, col)
|
||||||
{
|
{
|
||||||
var self = this;
|
|
||||||
|
|
||||||
if(col.id == 'zotero-items-column-title')
|
if(col.id == 'zotero-items-column-title')
|
||||||
{
|
{
|
||||||
// Get item type icon and tag swatches
|
// Get item type icon and tag swatches
|
||||||
|
@ -1086,8 +1084,8 @@ Zotero.ItemTreeView.prototype.getImageSrc = function(row, col)
|
||||||
item.getBestAttachmentState()
|
item.getBestAttachmentState()
|
||||||
// Refresh cell when promise is fulfilled
|
// Refresh cell when promise is fulfilled
|
||||||
.then(function (state) {
|
.then(function (state) {
|
||||||
self._treebox.invalidateCell(row, col);
|
this._treebox.invalidateCell(row, col);
|
||||||
})
|
}.bind(this))
|
||||||
.done();
|
.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1103,10 +1101,12 @@ Zotero.ItemTreeView.prototype.getImageSrc = function(row, col)
|
||||||
item.fileExists()
|
item.fileExists()
|
||||||
// Refresh cell when promise is fulfilled
|
// Refresh cell when promise is fulfilled
|
||||||
.then(function (exists) {
|
.then(function (exists) {
|
||||||
self._treebox.invalidateCell(row, col);
|
this._treebox.invalidateCell(row, col);
|
||||||
});
|
}.bind(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
Zotero.ItemTreeView.prototype.isContainer = function(row)
|
Zotero.ItemTreeView.prototype.isContainer = function(row)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user